EntryType
- the type of eventConsumerType
- the type of consumerpublic static interface RingBuffer.ConsumerAdapter<EntryType,ConsumerType>
consume(Object, Object, long, long)
, close(Object)
and
handleException(Object, Throwable, Object, long, long)
methods to other methods on an unknown type.Modifier and Type | Method and Description |
---|---|
void |
close(ConsumerType consumer)
Called by the
RingBuffer when the consume(Object, Object, long, long) method returns false, or when
the buffer has been shutdown and the consumer has consumed all entries in
the now-closed buffer. |
boolean |
consume(ConsumerType consumer,
EntryType entry,
long position,
long maxPosition)
Consume an entry from the ring buffer.
|
void |
handleException(ConsumerType consumer,
Throwable t,
EntryType entry,
long position,
long maxPosition)
Handle an exception that was thrown from the
consume(Object, Object, long, long) . |
boolean consume(ConsumerType consumer, EntryType entry, long position, long maxPosition)
handleException(Object, Throwable, Object, long, long)
being called.consumer
- the consumer instance that is to consume the event; never nullentry
- the entry; will not be nullposition
- the position of the entry within in the ring buffer; this is typically a monotonically-increasing valuemaxPosition
- the maximum position of entries in the ring buffer that are being consumed within the same batch;
this will be greater or equal to position
true
if the consumer should continue processing the next entry, or false
if this consumer is to
stop processing any more entries (from this or subsequent batches); returning false
provides a way for
the consumer to signal that it should no longer be usedvoid close(ConsumerType consumer)
RingBuffer
when the consume(Object, Object, long, long)
method returns false, or when
the buffer has been shutdown and the consumer has consumed
all entries in
the now-closed buffer.
This method allows any resources used by the consumer to be cleaned up when no longer needed
consumer
- the consumer instance that is being closed; never nullvoid handleException(ConsumerType consumer, Throwable t, EntryType entry, long position, long maxPosition)
consume(Object, Object, long, long)
.consumer
- the consumer instance that is to consume the event; never nullt
- the exception; never nullentry
- the entry during the consumption of which generated the exception; will not be nullposition
- the position of the entry within in the ring buffer; this is typically a monotonically-increasing valuemaxPosition
- the maximum position of entries in the ring buffer that are being consumed within the same batch;
this will be greater or equal to position
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.