public class RingBufferAllocatorSpec<T extends Recyclable> extends java.lang.Object implements Supplier<RingBufferAllocator<T>>
RingBufferAllocator. Provides an easy way to specify the
EventFactory, EventHandler, and ExceptionHandler via Reactor abstractions of Supplier and Consumer.| Constructor and Description |
|---|
RingBufferAllocatorSpec() |
| Modifier and Type | Method and Description |
|---|---|
RingBufferAllocatorSpec<T> |
allocator(Supplier<T> allocator)
The
Supplier to provide the RingBuffer with the reusable objects that are being
pooled. |
RingBufferAllocatorSpec<T> |
errorHandler(Consumer<java.lang.Throwable> errorHandler)
The
Consumer to be invoked when an error occurs. |
RingBufferAllocatorSpec<T> |
eventHandler(Consumer<Reference<T>> eventHandler)
The
Consumer to be invoked with a sequence ID is published. |
RingBufferAllocatorSpec<T> |
eventThreads(int eventThreads)
Specify the number of threads the underlying
RingBuffer will use. |
RingBufferAllocatorSpec<T> |
executor(java.util.concurrent.ExecutorService executor)
The
ExecutorService to use inside the RingBuffer. |
RingBufferAllocator<T> |
get()
Get an object.
|
RingBufferAllocatorSpec<T> |
name(java.lang.String name)
Name of the
RingBufferAllocator. |
RingBufferAllocatorSpec<T> |
producerType(com.lmax.disruptor.dsl.ProducerType producerType)
Specify single or multi-threaded producer.
|
RingBufferAllocatorSpec<T> |
ringSize(int ringSize)
Size of the
RingBuffer ring. |
RingBufferAllocatorSpec<T> |
waitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
Specify the
WaitStrategy to use (defaults to BlockingWaitStrategy). |
public RingBufferAllocatorSpec<T> name(java.lang.String name)
RingBufferAllocator.name - thispublic RingBufferAllocatorSpec<T> ringSize(int ringSize)
RingBuffer ring.ringSize - thispublic RingBufferAllocatorSpec<T> eventThreads(int eventThreads)
RingBuffer will use.eventThreads - number of threads for event handlersthispublic RingBufferAllocatorSpec<T> allocator(Supplier<T> allocator)
Supplier to provide the RingBuffer with the reusable objects that are being
pooled.allocator - thispublic RingBufferAllocatorSpec<T> eventHandler(Consumer<Reference<T>> eventHandler)
Consumer to be invoked with a sequence ID is published.eventHandler - thispublic RingBufferAllocatorSpec<T> errorHandler(Consumer<java.lang.Throwable> errorHandler)
Consumer to be invoked when an error occurs.errorHandler - thispublic RingBufferAllocatorSpec<T> producerType(com.lmax.disruptor.dsl.ProducerType producerType)
producerType - thispublic RingBufferAllocatorSpec<T> waitStrategy(com.lmax.disruptor.WaitStrategy waitStrategy)
WaitStrategy to use (defaults to BlockingWaitStrategy).waitStrategy - thispublic RingBufferAllocatorSpec<T> executor(java.util.concurrent.ExecutorService executor)
ExecutorService to use inside the RingBuffer.executor - thispublic RingBufferAllocator<T> get()
Supplierget in interface Supplier<RingBufferAllocator<T extends Recyclable>>