T
- the type of entries stored in the bufferC
- the type of consumerpublic class RingBufferBuilder<T,C> extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE |
static boolean |
DEFAULT_GARBAGE_COLLECT_ENTITIES |
static String |
DEFAULT_NAME |
Modifier | Constructor and Description |
---|---|
protected |
RingBufferBuilder(Executor executor,
RingBuffer.ConsumerAdapter<T,C> adapter) |
Modifier and Type | Method and Description |
---|---|
RingBuffer<T,C> |
build() |
protected Cursor |
defaultCursor(int bufferSize,
WaitStrategy waitStrategy) |
protected WaitStrategy |
defaultWaitStrategy() |
RingBufferBuilder<T,C> |
garbageCollect(boolean gcEntries) |
protected RingBufferBuilder<T,C> |
multipleProducers() |
RingBufferBuilder<T,C> |
named(String bufferName) |
RingBufferBuilder<T,C> |
ofSize(int bufferSize) |
protected RingBufferBuilder<T,C> |
singleProducer() |
RingBufferBuilder<T,C> |
waitUsing(WaitStrategy waitStrategy) |
static <T,C extends Consumer<T>> |
withMultipleProducers(Executor executor,
Class<T> entryClass)
|
static <T,C> RingBufferBuilder<T,C> |
withMultipleProducers(Executor executor,
RingBuffer.ConsumerAdapter<T,C> adapter)
Create a builder for ring buffers that use the supplied
Executor to create consumer threads and the supplied
RingBuffer.ConsumerAdapter to adapt to custom consumer implementations. |
static <T,C extends Consumer<T>> |
withSingleProducer(Executor executor,
Class<T> entryClass)
|
static <T,C> RingBufferBuilder<T,C> |
withSingleProducer(Executor executor,
RingBuffer.ConsumerAdapter<T,C> adapter)
Create a builder for ring buffers that use the supplied
Executor to create consumer threads and the supplied
RingBuffer.ConsumerAdapter to adapt to custom consumer implementations. |
public static final int DEFAULT_BUFFER_SIZE
public static final boolean DEFAULT_GARBAGE_COLLECT_ENTITIES
public static final String DEFAULT_NAME
protected RingBufferBuilder(Executor executor, RingBuffer.ConsumerAdapter<T,C> adapter)
executor
- the executor that should be used to create threads to run Consumer
s; may not be nulladapter
- the adapter for consumers; may not be nullpublic static <T,C> RingBufferBuilder<T,C> withSingleProducer(Executor executor, RingBuffer.ConsumerAdapter<T,C> adapter)
Executor
to create consumer threads and the supplied
RingBuffer.ConsumerAdapter
to adapt to custom consumer implementations. The ring buffer will only allow entries to be
added from a single thread.executor
- the executor that should be used to create threads to run Consumer
s; may not be nulladapter
- the adapter to the desired consumer interface; may not be nullpublic static <T,C extends Consumer<T>> RingBufferBuilder<T,C> withSingleProducer(Executor executor, Class<T> entryClass)
Executor
to create threads for each Consumer
instance. The ring buffer will only allow entries to be added from a single thread.executor
- the executor that should be used to create threads to run Consumer
s; may not be nullentryClass
- the type of entry that will be put into and consumed from the buffer; may not be nullpublic static <T,C> RingBufferBuilder<T,C> withMultipleProducers(Executor executor, RingBuffer.ConsumerAdapter<T,C> adapter)
Executor
to create consumer threads and the supplied
RingBuffer.ConsumerAdapter
to adapt to custom consumer implementations. The ring buffer will allow entries to be added from
multiple threads.executor
- the executor that should be used to create threads to run Consumer
s; may not be nulladapter
- the adapter to the desired consumer interface; may not be nullpublic static <T,C extends Consumer<T>> RingBufferBuilder<T,C> withMultipleProducers(Executor executor, Class<T> entryClass)
Executor
to create threads for each Consumer
instance. The ring buffer will allow entries to be added from multiple threads.executor
- the executor that should be used to create threads to run Consumer
s; may not be nullentryClass
- the type of entry that will be put into and consumed from the buffer; may not be nullpublic RingBufferBuilder<T,C> ofSize(int bufferSize)
public RingBufferBuilder<T,C> garbageCollect(boolean gcEntries)
public RingBufferBuilder<T,C> waitUsing(WaitStrategy waitStrategy)
protected RingBufferBuilder<T,C> singleProducer()
protected RingBufferBuilder<T,C> multipleProducers()
public RingBufferBuilder<T,C> named(String bufferName)
public RingBuffer<T,C> build()
protected WaitStrategy defaultWaitStrategy()
protected Cursor defaultCursor(int bufferSize, WaitStrategy waitStrategy)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.