Package org.eclipse.jetty.util.thread
Interface Invocable
- All Known Subinterfaces:
Callback
,Invocable.Task
- All Known Implementing Classes:
AsyncMiddleManServlet.ProxyReader
,AsyncMiddleManServlet.ProxyResponseListener
,AsyncProxyServlet.StreamReader
,Callback.Completable
,Callback.Completing
,Callback.Nested
,CountingCallback
,DeferredContentProvider
,DemandingFlusher
,DuplexHttpDestination
,FragmentExtension.FragmentingDemandingFlusher
,FrameFlusher
,FutureCallback
,Generator.Result
,HTTP2Flusher
,HTTP2Flusher.Entry
,HTTP2Stream
,HttpDestination
,HttpInput.Content
,HttpInput.EofContent
,HttpInput.ErrorContent
,HttpInput.SpecialContent
,HttpInput.WrappingContent
,InputStreamContentProvider
,Invocable.ReadyTask
,IteratingCallback
,IteratingNestedCallback
,MultiplexHttpDestination
,OutputStreamContentProvider
,ProxyProtocolClientConnectionFactory.ProxyProtocolConnection
,RequestContentAdapter
,SendHandlerCallback
,SharedBlockingCallback.Blocker
public interface Invocable
A task (typically either a Runnable
or Callable
that declares how it will behave when invoked:
- blocking, the invocation will certainly block (e.g. performs blocking I/O)
- non-blocking, the invocation will certainly not block
- either, the invocation may block
Static methods and are provided that allow the current thread to be tagged
with a ThreadLocal
to indicate if it has a blocking invocation type.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The behavior of anInvocable
when it is invoked.static class
ARunnable
decorated with anInvocable.InvocationType
.static interface
A task with anInvocable.InvocationType
. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Invocable.InvocationType
static Invocable.Task
from
(Invocable.InvocationType type, Runnable task) Creates aInvocable.Task
from the given InvocationType and Runnable.default Invocable.InvocationType
static Invocable.InvocationType
Get the invocation type of an Object.static void
invokeNonBlocking
(Runnable task) Invoke a task with the calling thread, tagged to indicate that it will not block.static boolean
Test if the current thread has been tagged as non blocking
-
Field Details
-
__nonBlocking
-
-
Method Details
-
from
Creates a
Invocable.Task
from the given InvocationType and Runnable.- Parameters:
type
- the InvocationTypetask
- the Runnable- Returns:
- a new Task
-
isNonBlockingInvocation
static boolean isNonBlockingInvocation()Test if the current thread has been tagged as non blocking- Returns:
- True if the task the current thread is running has indicated that it will not block.
-
invokeNonBlocking
Invoke a task with the calling thread, tagged to indicate that it will not block.- Parameters:
task
- The task to invoke.
-
combine
-
getInvocationType
Get the invocation type of an Object.- Parameters:
o
- The object to check the invocation type of.- Returns:
- If the object is an Invocable, it is coerced and the
getInvocationType()
used, otherwiseInvocable.InvocationType.BLOCKING
is returned.
-
getInvocationType
- Returns:
- The InvocationType of this object
-