-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Implementing Classes:
XnioIoThread
public interface XnioExecutor extends java.util.concurrent.ExecutorAn executor with the capability to run timed, cancellable tasks.- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceXnioExecutor.KeyA task key for a timeout task.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute(java.lang.Runnable command)Execute a task in this executor.XnioExecutor.KeyexecuteAfter(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)Execute a command after a period of time.XnioExecutor.KeyexecuteAtInterval(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)Execute a command repeatedly at a time interval until it is cancelled.
-
-
-
Method Detail
-
execute
void execute(java.lang.Runnable command)
Execute a task in this executor.- Specified by:
executein interfacejava.util.concurrent.Executor- Parameters:
command- the command to run
-
executeAfter
XnioExecutor.Key executeAfter(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)
Execute a command after a period of time. At least the amount of time given intimewill have elapsed when the task is run. The returned key may be used to cancel the task before it runs.- Parameters:
command- the command to executetime- the amount of time to delay, or0to run immediatelyunit- the time unit to apply totime- Returns:
- a key which may be used to cancel this task before it executes
-
executeAtInterval
XnioExecutor.Key executeAtInterval(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)
Execute a command repeatedly at a time interval until it is cancelled. At least the amount of time given intimewill have elapsed when the task is first run, and again for each subsequent run. The returned key may be used to cancel the task before it runs.- Parameters:
command- the command to executetime- the amount of time to delay, or0to run immediatelyunit- the time unit to apply totime- Returns:
- a key which may be used to cancel this task before it executes
-
-