public class IstiRunnableQueue
extends java.lang.Object
implements java.util.concurrent.Executor
Constructor and Description |
---|
IstiRunnableQueue(int period,
java.util.concurrent.Executor e)
Create the runnable queue.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Runnable command) |
boolean |
invokeLater(java.util.concurrent.atomic.AtomicLong atomicLong,
long time,
java.lang.Runnable runnable)
Causes runnable.run() to be executed at or slightly after the
specified time.
|
void |
invokeLater(java.lang.Number time,
java.lang.Runnable runnable)
Causes runnable.run() to be executed at or slightly after the
specified time.
|
protected void |
resetTime(java.lang.Number number)
Reset the time.
|
public IstiRunnableQueue(int period, java.util.concurrent.Executor e)
period
- the period.the
- e or null to use the same thread as the queue.public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
public boolean invokeLater(java.util.concurrent.atomic.AtomicLong atomicLong, long time, java.lang.Runnable runnable)
The Runnable
will only be called if the
atomicLong
value is set to 0 which happens after it is run in
order to allow the caller to know if it has already been run or not.
atomicLong
- the time to check before running,time
- time at which the Runnable
is to be
executed.runnable
- the Runnable
whose run
to be
executed.true
- if the Runnable
will be executed, false
otherwise.public void invokeLater(java.lang.Number time, java.lang.Runnable runnable)
If the time is an AtomicLong
then the time value is set to 0
after it is run in order to allow the caller to know if it has already been
run or not.
time
- time at which the Runnable
is to be executed.runnable
- the Runnable
whose run
to be
executed.protected void resetTime(java.lang.Number number)