Class SerializedInvoker
java.lang.Object
org.eclipse.jetty.util.thread.SerializedInvoker
Ensures serial invocation of submitted tasks.
The Invocable.InvocationType of the Runnable returned from this class is
always Invocable.InvocationType.BLOCKING since a blocking task may be added to the queue
at any time.
This class was inspired by the public domain class NonBlockingMutexExecutor
- 
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance whose name isanonymous.SerializedInvoker(Class<?> nameFrom) Creates a new instance whose name is derived from the given class.SerializedInvoker(String name) Creates a new instance with the given name.SerializedInvoker(String name, Executor executor) Creates a new instance with the given name andExecutor. - 
Method Summary
Modifier and TypeMethodDescriptionvoidArrange for a task to be invoked, mutually excluded from other tasks.Arrange for tasks to be invoked, mutually excluded from other tasks.protected voidvoidArrange for a task to be run, mutually excluded from other tasks.voidArrange for tasks to be executed, mutually excluded from other tasks.toString() 
- 
Constructor Details
- 
SerializedInvoker
public SerializedInvoker()Creates a new instance whose name isanonymous. - 
SerializedInvoker
Creates a new instance whose name is derived from the given class.- Parameters:
 nameFrom- the class to use as a name.
 - 
SerializedInvoker
Creates a new instance with the given name.- Parameters:
 name- the name.
 - 
SerializedInvoker
 
 - 
 - 
Method Details
- 
assertCurrentThreadInvoking
- Throws:
 IllegalStateException- when the current thread is not currently executing a task using this invoker
 - 
offer
 - 
offer
 - 
run
Arrange for a task to be run, mutually excluded from other tasks. This is equivalent to directly running anyRunnablereturned fromoffer(Runnable)- Parameters:
 task- The task to invoke
 - 
run
Arrange for tasks to be executed, mutually excluded from other tasks. This is equivalent to directly running anyRunnablereturned fromoffer(Runnable...)- Parameters:
 tasks- The tasks to invoke
 - 
toString
 - 
onError
 
 -