|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lmax.disruptor.BatchConsumer<T>
T
- Entry implementation storing the data for sharing during exchange or parallel coordination of an event.public final class BatchConsumer<T extends AbstractEntry>
Convenience class for handling the batching semantics of consuming entries from a RingBuffer
and delegating the available AbstractEntry
s to a BatchHandler
.
If the BatchHandler
also implements LifecycleAware
it will be notified just after the thread
is started and just before the thread is shutdown.
Nested Class Summary | |
---|---|
class |
BatchConsumer.SequenceTrackerCallback
Used by the BatchHandler to signal when it has completed consuming a given sequence. |
Field Summary | |
---|---|
long |
p1
|
long |
p10
|
long |
p11
|
long |
p12
|
long |
p13
|
long |
p14
|
long |
p15
|
long |
p16
|
long |
p17
|
long |
p18
|
long |
p19
|
long |
p2
|
long |
p20
|
long |
p3
|
long |
p4
|
long |
p5
|
long |
p6
|
long |
p7
|
long |
p8
|
long |
p9
|
Constructor Summary | |
---|---|
BatchConsumer(ConsumerBarrier<T> consumerBarrier,
BatchHandler<T> handler)
Construct a batch consumer that will automatically track the progress by updating its sequence when the BatchHandler.onAvailable(AbstractEntry) method returns. |
|
BatchConsumer(ConsumerBarrier<T> consumerBarrier,
SequenceTrackingHandler<T> entryHandler)
Construct a batch consumer that will rely on the SequenceTrackingHandler
to callback via the BatchConsumer.SequenceTrackerCallback when it has
completed with a sequence within a batch. |
Method Summary | |
---|---|
ConsumerBarrier<? extends T> |
getConsumerBarrier()
Get the ConsumerBarrier the Consumer is waiting on. |
long |
getSequence()
Get the sequence up to which this Consumer has consumed AbstractEntry s |
void |
halt()
Signal that this Consumer should stop when it has finished consuming at the next clean break. |
void |
run()
It is ok to have another thread rerun this method after a halt(). |
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Set a new ExceptionHandler for handling exceptions propagated out of the BatchConsumer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public long p1
public long p2
public long p3
public long p4
public long p5
public long p6
public long p7
public long p8
public long p9
public long p10
public long p11
public long p12
public long p13
public long p14
public long p15
public long p16
public long p17
public long p18
public long p19
public long p20
Constructor Detail |
---|
public BatchConsumer(ConsumerBarrier<T> consumerBarrier, BatchHandler<T> handler)
BatchHandler.onAvailable(AbstractEntry)
method returns.
consumerBarrier
- on which it is waiting.handler
- is the delegate to which AbstractEntry
s are dispatched.public BatchConsumer(ConsumerBarrier<T> consumerBarrier, SequenceTrackingHandler<T> entryHandler)
SequenceTrackingHandler
to callback via the BatchConsumer.SequenceTrackerCallback
when it has
completed with a sequence within a batch. Sequence will be updated at the end of
a batch regardless.
consumerBarrier
- on which it is waiting.entryHandler
- is the delegate to which AbstractEntry
s are dispatched.Method Detail |
---|
public long getSequence()
Consumer
AbstractEntry
s
getSequence
in interface Consumer
AbstractEntry
public void halt()
Consumer
ConsumerBarrier.alert()
to notify the thread to check status.
halt
in interface Consumer
public void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler
for handling exceptions propagated out of the BatchConsumer
exceptionHandler
- to replace the existing exceptionHandler.public ConsumerBarrier<? extends T> getConsumerBarrier()
ConsumerBarrier
the Consumer
is waiting on.
Consumer
is using.public void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |