Top Description Inners Methods
org.xnio

public Interface XnioExecutor

extends Executor
Known Direct Implementers
org.xnio.XnioIoThread
Annotations
@SuppressWarnings:unused
Imports
java.util.concurrent.Executor, .TimeUnit

An executor with the capability to run timed, cancellable tasks.
Author
David M. Lloyd

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
XnioExecutor.Key

A task key for a timeout task.

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable
the command to run
command
)

Redeclares java.util.concurrent.Executor.execute.

Execute a task in this executor.

public XnioExecutor.Key

Returns:

a key which may be used to cancel this task before it executes
executeAfter
(Runnable
the command to execute
command
,
long
the amount of time to delay, or 0 to run immediately
time
,
TimeUnit
the time unit to apply to time
unit
)

Execute a command after a period of time.

public XnioExecutor.Key

Returns:

a key which may be used to cancel this task before it executes
executeAtInterval
(Runnable
the command to execute
command
,
long
the amount of time to delay, or 0 to run immediately
time
,
TimeUnit
the time unit to apply to time
unit
)

Execute a command repeatedly at a time interval until it is cancelled.

Method Detail

executeback to summary
public void execute(Runnable command)

Redeclares java.util.concurrent.Executor.execute.

Execute a task in this executor.

Parameters
command:Runnable

the command to run

executeAfterback to summary
public XnioExecutor.Key executeAfter(Runnable command, long time, TimeUnit unit)

Execute a command after a period of time. At least the amount of time given in time will have elapsed when the task is run. The returned key may be used to cancel the task before it runs.

Parameters
command:Runnable

the command to execute

time:long

the amount of time to delay, or 0 to run immediately

unit:TimeUnit

the time unit to apply to time

Returns:XnioExecutor.Key

a key which may be used to cancel this task before it executes

executeAtIntervalback to summary
public XnioExecutor.Key executeAtInterval(Runnable command, long time, TimeUnit unit)

Execute a command repeatedly at a time interval until it is cancelled. At least the amount of time given in time will 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:Runnable

the command to execute

time:long

the amount of time to delay, or 0 to run immediately

unit:TimeUnit

the time unit to apply to time

Returns:XnioExecutor.Key

a key which may be used to cancel this task before it executes

org.xnio back to summary

public Interface XnioExecutor.Key


A task key for a timeout task.

Field Summary

Modifier and TypeField and Description
public static final XnioExecutor.Key
IMMEDIATE

An immediate key.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the task was cancelled; false if it already ran
remove
()

Remove a previously-submitted task.

Field Detail

IMMEDIATEback to summary
public static final XnioExecutor.Key IMMEDIATE

An immediate key. When the time delay is <= 0, this may be returned and the task immediately run.

Method Detail

removeback to summary
public boolean remove()

Remove a previously-submitted task.

Returns:boolean

true if the task was cancelled; false if it already ran