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 scheduledIllegalArgumentException
protected void expire() throws IllegalMonitorStateException
IllegalMonitorStateException
protected void timeout() throws IllegalMonitorStateException
IllegalMonitorStateException
public boolean isTimedOut()
public boolean isExpired()
public Thread getCurrentOwner()
public boolean acquireValidLock()
public void releaseLockAndNotify() throws IllegalMonitorStateException
IllegalMonitorStateException
public void setHeadTask(HeadTaskRunnable headTask)
setHeadTask
in interface TaskRunnable
headTask
- The HeadTaskRunnablepublic HeadTaskRunnable getHeadTask()
getHeadTask
in interface TaskRunnable
public boolean addElement(Object key)
addElement
in interface TaskRunnable
key
- Element to be added to this TaskRunnablepublic boolean removeElement(Object key)
removeElement
in interface TaskRunnable
key
- Element to be removed from this TaskRunnablepublic boolean isEmpty()
isEmpty
in interface TaskRunnable
public void setNext(TaskRunnable task)
setNext
in interface TaskRunnable
task
- The next TaskRunnablepublic void setPrevious(TaskRunnable task)
setPrevious
in interface TaskRunnable
task
- The previous TaskRunnablepublic TaskRunnable next()
next
in interface TaskRunnable
public TaskRunnable previous()
previous
in interface TaskRunnable
public long getRunPeriod()
getRunPeriod
in interface TaskRunnable
public void cancel()
cancel
in interface TaskRunnable
public 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 TaskRunnable
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.