Top Description Inners Fields Methods
org.eclipse.jetty.util.thread

public Interface TryExecutor

extends Executor
Known Direct Implementers
org.eclipse.jetty.util.thread.TryExecutor.NoTryExecutor, org.eclipse.jetty.util.thread.ExecutorThreadPool, org.eclipse.jetty.util.thread.QueuedThreadPool, org.eclipse.jetty.util.thread.ReservedThreadExecutor
Imports
java.util.concurrent.Executor, .RejectedExecutionException

A variation of Executor that can confirm if a thread is available immediately

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final TryExecutor

Method Summary

Modifier and TypeMethod and Description
public static TryExecutor
public default void
execute(Runnable
the runnable task
task
)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

public boolean

Returns:

True IFF the task has been given directly to a thread to execute. The task cannot be queued pending the later availability of a Thread.
tryExecute
(Runnable
The task to be executed
task
)

Attempt to execute a task.

Field Detail

NO_TRYback to summary
public static final TryExecutor NO_TRY

Method Detail

asTryExecutorback to summary
public static TryExecutor asTryExecutor(Executor executor)
executeback to summary
public default void execute(Runnable task)

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
task:Runnable

the runnable task

Annotations
@Override
tryExecuteback to summary
public boolean tryExecute(Runnable task)

Attempt to execute a task.

Parameters
task:Runnable

The task to be executed

Returns:boolean

True IFF the task has been given directly to a thread to execute. The task cannot be queued pending the later availability of a Thread.

org.eclipse.jetty.util.thread back to summary

public Class TryExecutor.NoTryExecutor

extends Object
implements TryExecutor
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.thread.TryExecutor, java.util.concurrent.Executor

Field Summary

Modifier and TypeField and Description
private final Executor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable
the runnable task
task
)

Overrides default org.eclipse.jetty.util.thread.TryExecutor.execute.

Executes the given command at some time in the future.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
tryExecute(Runnable
The task to be executed
task
)

Implements org.eclipse.jetty.util.thread.TryExecutor.tryExecute.

Attempt to execute a task.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

executorback to summary
private final Executor executor

Constructor Detail

NoTryExecutorback to summary
public NoTryExecutor(Executor executor)

Method Detail

executeback to summary
public void execute(Runnable task)

Overrides default org.eclipse.jetty.util.thread.TryExecutor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
task:Runnable

the runnable task

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
tryExecuteback to summary
public boolean tryExecute(Runnable task)

Implements org.eclipse.jetty.util.thread.TryExecutor.tryExecute.

Doc from org.eclipse.jetty.util.thread.TryExecutor.tryExecute.

Attempt to execute a task.

Parameters
task:Runnable

The task to be executed

Returns:boolean

True IFF the task has been given directly to a thread to execute. The task cannot be queued pending the later availability of a Thread.

Annotations
@Override