public class ProcessorSpec<T> extends java.lang.Object implements Supplier<Processor<T>>
Processors.| Constructor and Description |
|---|
ProcessorSpec() |
| Modifier and Type | Method and Description |
|---|---|
ProcessorSpec<T> |
blockingWaitStrategy()
Set
BlockingWaitStrategy as wait strategy. |
ProcessorSpec<T> |
busySpinWaitStrategy()
Set
BusySpinWaitStrategy as wait strategy. |
ProcessorSpec<T> |
consume(Consumer<T> consumer)
When data is mutated and published into the
Processor, invoke the given Consumer and pass the
mutated data. |
ProcessorSpec<T> |
dataBufferSize(int dataBufferSize)
How many data objects to pre-allocate in the buffer.
|
ProcessorSpec<T> |
dataSupplier(Supplier<T> dataSupplier)
Use the given
Supplier to provide new instances of the data object for pre-allocation. |
Processor<T> |
get()
Get an object.
|
ProcessorSpec<T> |
multiThreadedProducer()
Protect against publication of data events from multiple producer threads.
|
ProcessorSpec<T> |
singleThreadedProducer()
Optimize for highest throughput by assuming only a single thread will be publishing data events into this
Processor. |
ProcessorSpec<T> |
sleepingWaitStrategy()
Set
SleepingWaitStrategy as wait strategy. |
ProcessorSpec<T> |
waitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
Set Disruptor's
WaitStrategy. |
ProcessorSpec<T> |
when(java.lang.Class<? extends java.lang.Throwable> type,
Consumer<java.lang.Throwable> errorConsumer)
Assign the given
Consumer as an error handler for exceptions of the given type. |
ProcessorSpec<T> |
yieldingWaitStrategy()
Set
YieldingWaitStrategy as wait strategy. |
public ProcessorSpec<T> multiThreadedProducer()
public ProcessorSpec<T> singleThreadedProducer()
Processor.public ProcessorSpec<T> dataBufferSize(int dataBufferSize)
dataBufferSize - number of data objects to pre-allocatepublic ProcessorSpec<T> dataSupplier(Supplier<T> dataSupplier)
Supplier to provide new instances of the data object for pre-allocation.dataSupplier - the Supplier to provide new data instancespublic ProcessorSpec<T> waitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
WaitStrategy.waitStrategy - the WaitStrategy to usepublic ProcessorSpec<T> blockingWaitStrategy()
BlockingWaitStrategy as wait strategy.public ProcessorSpec<T> sleepingWaitStrategy()
SleepingWaitStrategy as wait strategy.public ProcessorSpec<T> yieldingWaitStrategy()
YieldingWaitStrategy as wait strategy.public ProcessorSpec<T> busySpinWaitStrategy()
BusySpinWaitStrategy as wait strategy.public ProcessorSpec<T> consume(Consumer<T> consumer)
Processor, invoke the given Consumer and pass the
mutated data.consumer - the mutated event data Consumerpublic ProcessorSpec<T> when(java.lang.Class<? extends java.lang.Throwable> type, Consumer<java.lang.Throwable> errorConsumer)
Consumer as an error handler for exceptions of the given type.type - type of the exception to handleerrorConsumer - exception Consumer