public class HeadTaskRunnable extends Object implements TaskRunnable
| Modifier and Type | Field and Description |
|---|---|
protected int |
acquireCount |
protected boolean |
expired |
protected TaskRunnable |
nextTask |
protected Thread |
owner |
protected Triggerable |
parent |
protected TaskRunnable |
tailTask |
protected Date |
time |
protected boolean |
timeout |
protected int |
waitCount |
| Constructor and Description |
|---|
HeadTaskRunnable(Triggerable parent,
TaskRunnable nextTask,
Date time)
Constructor of HeadTaskRunnable.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acquireValidLock()
Tries to acquire a valid (non-expired) lock.
|
boolean |
addElement(Object key)
Implements for TaskRunnable interface, always return false.
|
void |
cancel()
Implements for TaskRunnable interface.
|
protected void |
expire()
Sets the status of the HeadTask to expired.
|
Thread |
getCurrentOwner()
Returns the thread which currently holding this lock.
|
HeadTaskRunnable |
getHeadTask()
Implements for TaskRunnable interface, no actual use for HeadTaskRunnable.
|
long |
getRunPeriod()
Implements for TaskRunnable interface, HeadTaskRunnable doesn't have a
run period.
|
boolean |
isEmpty()
Implements for TaskRunnable interface, always return false.
|
boolean |
isExpired()
Returns a boolean to indicate whether the HeadTask is expired already.
|
boolean |
isTimedOut()
Returns a boolean to indicate whether the HeadTask is timeout already.
|
TaskRunnable |
next()
Returns the TaskRunnable next to this TaskRunnable in the linked-list.
|
TaskRunnable |
previous()
Implements for TaskRunnable interface, there is no previous element for
HeadTaskRunnable.
|
void |
releaseLockAndNotify()
Releases the currently holding lock.
|
boolean |
removeElement(Object key)
Implements for TaskRunnable interface, always return false.
|
void |
run()
Implements for TaskRunnable interface, just run the next TaskRunnable.
|
long |
scheduledExecutionTime()
Returns the time which this HeadTaskRunnable is scheduled.
|
void |
setHeadTask(HeadTaskRunnable headTask)
Implements for TaskRunnable interface, no actual use for HeadTaskRunnable.
|
void |
setNext(TaskRunnable task)
Sets the TaskRunnable next to this TaskRunnable in the linked-list.
|
void |
setPrevious(TaskRunnable task)
Implements for TaskRunnable interface, There is no previous element for
HeadTaskRunnable.
|
void |
setTail(TaskRunnable task)
Sets the task which is the tail of the list.
|
void |
setTrigger(Triggerable parent)
Sets the Triggerable interface which will be run when the linked-list is
empty.
|
TaskRunnable |
tail()
Returns the Task which is at the tail of the list.
|
protected void |
timeout()
Sets the status of the HeadTask to timeout.
|
protected Date time
protected volatile TaskRunnable nextTask
protected volatile TaskRunnable tailTask
protected volatile boolean expired
protected volatile boolean timeout
protected int waitCount
protected int acquireCount
protected volatile Thread owner
protected Triggerable parent
public HeadTaskRunnable(Triggerable parent, TaskRunnable nextTask, Date time) throws IllegalArgumentException
parent - The Triggerable interface to be run when the linked-list is
emptynextTask - The TaskRunnable next to this TaskRunnabletime - The time this TaskRunnable is scheduledIllegalArgumentExceptionprotected void expire()
throws IllegalMonitorStateException
IllegalMonitorStateExceptionprotected void timeout()
throws IllegalMonitorStateException
IllegalMonitorStateExceptionpublic boolean isTimedOut()
public boolean isExpired()
public Thread getCurrentOwner()
public boolean acquireValidLock()
public void releaseLockAndNotify()
throws IllegalMonitorStateException
IllegalMonitorStateExceptionpublic void setHeadTask(HeadTaskRunnable headTask)
setHeadTask in interface TaskRunnableheadTask - The HeadTaskRunnablepublic HeadTaskRunnable getHeadTask()
getHeadTask in interface TaskRunnablepublic boolean addElement(Object key)
addElement in interface TaskRunnablekey - Element to be added to this TaskRunnablepublic boolean removeElement(Object key)
removeElement in interface TaskRunnablekey - Element to be removed from this TaskRunnablepublic boolean isEmpty()
isEmpty in interface TaskRunnablepublic void setNext(TaskRunnable task)
setNext in interface TaskRunnabletask - The next TaskRunnablepublic void setPrevious(TaskRunnable task)
setPrevious in interface TaskRunnabletask - The previous TaskRunnablepublic TaskRunnable next()
next in interface TaskRunnablepublic TaskRunnable previous()
previous in interface TaskRunnablepublic long getRunPeriod()
getRunPeriod in interface TaskRunnablepublic void cancel()
cancel in interface TaskRunnablepublic void setTrigger(Triggerable parent)
parent - The Triggerable interface to be run when the linked-list is
emptypublic void setTail(TaskRunnable task)
task - The task which is at the tail of the list.public TaskRunnable tail()
public long scheduledExecutionTime()
scheduledExecutionTime in interface TaskRunnableCopyright © 2010–2023 Open Identity Platform Community. All rights reserved.