Enum Class Invocable.InvocationType
- All Implemented Interfaces:
Serializable
,Comparable<Invocable.InvocationType>
,Constable
- Enclosing interface:
- Invocable
The behavior of an Invocable
when it is invoked.
Typically, Runnable
s or Callback
s declare their
invocation type; this information is then used by the code that should
invoke the Runnable
or Callback
to decide whether to
invoke it directly, or submit it to a thread pool to be invoked by
a different thread.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionInvoking theInvocable
may block the invoker thread, and the invocation may be performed immediately (possibly blocking the invoker thread) or deferred to a later time, for example by submitting theInvocable
to a thread pool.Invoking theInvocable
does not block the invoker thread, and the invocation may be performed immediately in the invoker thread. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
runWithoutBlocking
(Runnable task, Executor executor) Run or Execute the task according to the InvocationType without blocking the caller:NON_BLOCKING
The task is run directlyBLOCKING
The task is executed by the passed executorEITHER
The task is invoked viaInvocable.invokeNonBlocking(Runnable)
static Invocable.InvocationType
Returns the enum constant of this class with the specified name.static Invocable.InvocationType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLOCKING
Invoking the
Invocable
may block the invoker thread, and the invocation may be performed immediately (possibly blocking the invoker thread) or deferred to a later time, for example by submitting theInvocable
to a thread pool.This invocation type is suitable for
Invocable
s that call application code, for example to process an HTTP request. -
NON_BLOCKING
Invoking the
Invocable
does not block the invoker thread, and the invocation may be performed immediately in the invoker thread.This invocation type is suitable for
Invocable
s that call implementation code that is guaranteed to never block the invoker thread. -
EITHER
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
runWithoutBlocking
Run or Execute the task according to the InvocationType without blocking the caller:NON_BLOCKING
- The task is run directly
BLOCKING
- The task is executed by the passed executor
EITHER
- The task is invoked via
Invocable.invokeNonBlocking(Runnable)
- Parameters:
task
- The task to runexecutor
- The executor to use if necessary
-