public final class MpscDispatcher extends SingleThreadDispatcher
Dispatcher that uses a MpscLinkedQueue to
queue tasks to execute.SingleThreadDispatcher.SingleThreadTaskAbstractLifecycleDispatcher.Taskbacklog, tailRecurseSeq, tailRecursionPile, tailRecursionPileSizecontext| Constructor and Description |
|---|
MpscDispatcher(java.lang.String name)
Creates a new
MpscDispatcher with the given name. |
MpscDispatcher(java.lang.String name,
int bufferSize)
Creates a new
MpscDispatcher with the given name. |
| Modifier and Type | Method and Description |
|---|---|
protected AbstractLifecycleDispatcher.Task |
allocateTask() |
boolean |
awaitAndShutdown(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Block until all submitted tasks have completed, then do a normal
Resource.shutdown(). |
protected void |
execute(AbstractLifecycleDispatcher.Task task) |
void |
forceShutdown()
Shutdown this
Resource, forcibly halting any work currently executing and discarding any tasks that
have not yet been executed. |
long |
remainingSlots()
Request the remaining capacity for the underlying shared state structure.
|
void |
shutdown()
Shutdown this active
Resource such that it can no longer be used. |
protected AbstractLifecycleDispatcher.Task |
tryAllocateTask() |
allocateRecursiveTask, backlogSize, expandTailRecursionPile, getTailRecursionPileSize, supportsOrderingalive, awaitAndShutdown, dispatch, execute, getContext, inContext, route, scheduleLater, toString, tryDispatchpublic MpscDispatcher(java.lang.String name)
MpscDispatcher with the given name. It will use a MpscLinkedQueue and a virtual capacity of 1024 slots.name - The name of the dispatcher.public MpscDispatcher(java.lang.String name,
int bufferSize)
MpscDispatcher with the given name. It will use a MpscLinkedQueue and a virtual capacity of {code bufferSize}name - The name of the dispatcherbufferSize - The size to configure the ring buffer withpublic boolean awaitAndShutdown(long timeout,
java.util.concurrent.TimeUnit timeUnit)
ResourceResource.shutdown().public void shutdown()
ResourceResource such that it can no longer be used. If the resource carries any work,
it will wait (but NOT blocking the caller) for all the remaining tasks to perform before closing the resource.shutdown in interface Resourceshutdown in class AbstractLifecycleDispatcherpublic void forceShutdown()
ResourceResource, forcibly halting any work currently executing and discarding any tasks that
have not yet been executed.forceShutdown in interface ResourceforceShutdown in class AbstractLifecycleDispatcherpublic long remainingSlots()
DispatcherRingBufferDispatcher will return
RingBuffer.remainingCapacity().
protected AbstractLifecycleDispatcher.Task tryAllocateTask() throws InsufficientCapacityException
tryAllocateTask in class AbstractLifecycleDispatcherInsufficientCapacityExceptionprotected AbstractLifecycleDispatcher.Task allocateTask()
allocateTask in class SingleThreadDispatcherprotected void execute(AbstractLifecycleDispatcher.Task task)
execute in class AbstractLifecycleDispatcher