Package com.sun.identity.common
Class InstantRunnable
- java.lang.Object
-
- com.sun.identity.common.GeneralTaskRunnable
-
- com.sun.identity.common.InstantRunnable
-
- All Implemented Interfaces:
TaskRunnable
,Runnable
- Direct Known Subclasses:
InstantGroupRunnable
public class InstantRunnable extends GeneralTaskRunnable
Instant task (task will only be run once) which has handler integrated (implements ScheduleableAction) can be scheduled to Timer or TimerPool by using InstantRunnable. All the elements in the same InstantRunnable must have the same scheduled time.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set
actions
protected boolean
allowToChange
protected boolean
removeElementAfterAction
-
Fields inherited from class com.sun.identity.common.GeneralTaskRunnable
headTask, nextTask, previousTask
-
-
Constructor Summary
Constructors Constructor Description InstantRunnable(boolean removeElementAfterAction)
Constructor of InstantRunnable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addElement(Object obj)
Adds an element to this InstantRunnable.long
getRunPeriod()
Returns the run period of this InstantRunnable.boolean
isEmpty()
Indicates whether this InstantRunnable is empty.boolean
removeElement(Object obj)
Removes an element from this InstantRunnable.void
reset()
Resets this InstantRunnable to allow elements to be added.void
run()
Implements for TaskRunnable.-
Methods inherited from class com.sun.identity.common.GeneralTaskRunnable
cancel, getHeadTask, isScheduled, next, previous, scheduledExecutionTime, setHeadTask, setNext, setPrevious
-
-
-
-
Field Detail
-
actions
protected Set actions
-
removeElementAfterAction
protected boolean removeElementAfterAction
-
allowToChange
protected volatile boolean allowToChange
-
-
Method Detail
-
run
public void run()
Implements for TaskRunnable. Run the function of ScheduleableAction on all the objects 1 by 1.
-
addElement
public boolean addElement(Object obj)
Adds an element to this InstantRunnable.- Parameters:
obj
- Element to be added to this InstantRunnable- Returns:
- a boolean to indicate whether the add success
-
removeElement
public boolean removeElement(Object obj)
Removes an element from this InstantRunnable.- Parameters:
obj
- Element to be removed from this InstantRunnable- Returns:
- A boolean to indicate whether the remove success
-
isEmpty
public boolean isEmpty()
Indicates whether this InstantRunnable is empty.- Returns:
- A boolean to indicate whether this InstantRunnable is empty
-
getRunPeriod
public long getRunPeriod()
Returns the run period of this InstantRunnable.- Returns:
- -1 means this task doesn't have a run period
-
reset
public void reset()
Resets this InstantRunnable to allow elements to be added.
-
-