Enum Class Invocable.InvocationType
- All Implemented Interfaces:
 Serializable, Comparable<Invocable.InvocationType>, Constable
- Enclosing interface:
 Invocable
The behavior of an Invocable task when it is called.
Typically, tasks such as Runnables or Callbacks 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 Enum
Enum.EnumDesc<E> - 
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInvoking the task 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 the task to a thread pool.Invoking the task may act either as aBLOCKINGtask if invoked directly; or as aNON_BLOCKINGtask if invoked viaInvocable.invokeNonBlocking(Runnable).Invoking the task does not block the invoker thread, and the invocation must be performed immediately in the invoker thread. - 
Method Summary
Modifier and TypeMethodDescriptionabstract voidrunWithoutBlocking(Runnable task, Executor executor) Runs or executes the task according to theInvocationType, without blocking the caller:static Invocable.InvocationTypeReturns 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 task 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 the task to a thread pool.
This invocation type is suitable for tasks that call application code, for example to process an HTTP request.
 - 
NON_BLOCKING
Invoking the task does not block the invoker thread, and the invocation must be performed immediately in the invoker thread.
This invocation type is suitable for tasks that cannot be deferred and guarantee that their code never blocks the invoker thread.
 - 
EITHER
Invoking the task may act either as a
BLOCKINGtask if invoked directly; or as aNON_BLOCKINGtask if invoked viaInvocable.invokeNonBlocking(Runnable).The implementation of the task must check
Invocable.isNonBlockingInvocation()to determine how it was called.This invocation type is suitable for tasks that have multiple subtasks, some of which that cannot be deferred mixed with other subtasks that can be. An invoker which has an
EITHERtask must call it immediately, either directly, so that it may block; or viaInvocable.invokeNonBlocking(Runnable)so that it may not. The invoker cannot defer the task execution, and specifically it must not queue theEITHERtask in a thread pool.See the
AdaptiveExecutionStrategyfor an example of both an invoker ofEITHERtasks, and as an implementation of anEITHERtask, when used in a chain ofExecutionStrategys. 
 - 
 - 
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
Runs or executes the task according to the
InvocationType, without blocking the caller:NON_BLOCKING- The task is run directly
 BLOCKING- The task is submitted to the given 
Executor EITHER- The task is invoked via 
Invocable.invokeNonBlocking(Runnable) 
- Parameters:
 task- The task to runexecutor- TheExecutorto use if necessary
 
 -