public class RingBufferDispatcher extends AbstractSingleThreadDispatcher
Dispatcher that uses a RingBuffer to queue tasks to execute.AbstractSingleThreadDispatcher.SingleThreadTaskAbstractLifecycleDispatcher.Task| Constructor and Description |
|---|
RingBufferDispatcher(java.lang.String name)
Creates a new
RingBufferDispatcher with the given name. |
RingBufferDispatcher(java.lang.String name,
int bufferSize,
Consumer<java.lang.Throwable> uncaughtExceptionHandler,
com.lmax.disruptor.dsl.ProducerType producerType,
com.lmax.disruptor.WaitStrategy waitStrategy)
Creates a new RingBufferDispatcher 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
Dispatcher.shutdown(). |
protected void |
execute(AbstractLifecycleDispatcher.Task task) |
void |
halt()
Shutdown this
Dispatcher, forcibly halting any tasks currently executing and discarding any tasks that have
not yet been exected. |
void |
shutdown()
Shutdown this
Dispatcher such that it can no longer be used. |
allocateRecursiveTask, expandTailRecursionPile, getBacklogaddToTailRecursionPile, alive, awaitAndShutdown, dispatch, dispatch, execute, getContext, isInContext, routepublic RingBufferDispatcher(java.lang.String name)
RingBufferDispatcher with the given name. It will use a RingBuffer with 1024 slots,
configured with a producer type of MULTI and a blocking wait
strategy.name - The name of the dispatcher.public RingBufferDispatcher(java.lang.String name,
int bufferSize,
Consumer<java.lang.Throwable> uncaughtExceptionHandler,
com.lmax.disruptor.dsl.ProducerType producerType,
com.lmax.disruptor.WaitStrategy waitStrategy)
name. It will use a RingBuffer with
bufferSize slots, configured with the given producerType and waitStrategy.name - The name of the dispatcherbufferSize - The size to configure the ring buffer withproducerType - The producer type to configure the ring buffer withwaitStrategy - The wait strategy to configure the ring buffer withpublic boolean awaitAndShutdown(long timeout,
java.util.concurrent.TimeUnit timeUnit)
DispatcherDispatcher.shutdown().public void shutdown()
DispatcherDispatcher such that it can no longer be used.shutdown in interface Dispatchershutdown in class AbstractLifecycleDispatcherpublic void halt()
DispatcherDispatcher, forcibly halting any tasks currently executing and discarding any tasks that have
not yet been exected.halt in interface Dispatcherhalt in class AbstractLifecycleDispatcherprotected AbstractLifecycleDispatcher.Task allocateTask()
allocateTask in class AbstractSingleThreadDispatcherprotected void execute(AbstractLifecycleDispatcher.Task task)
execute in class AbstractLifecycleDispatcher