T
- the type of entry@NotThreadSafe public abstract class Consumer<T> extends Object implements AutoCloseable
Constructor and Description |
---|
Consumer() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Called by the
RingBuffer when the buffer has been shutdown and after this consumer's has
consumed all entries that remain in the now-closed buffer. |
abstract boolean |
consume(T entry,
long position,
long maxPosition)
Consume an entry from the ring buffer.
|
public abstract boolean consume(T entry, long position, long maxPosition)
entry
- the entryposition
- the position of the entry in the ring buffer;maxPosition
- the maximum position that available in the ring buffer; in the case of a batch of entries, this may be
greater than positionpublic void close()
RingBuffer
when the buffer has been shutdown and after this consumer's has
consumed
all entries that remain in the now-closed buffer.
This method does nothing by default, but subclasses can override it to be notified when the consumer will not be called again and can clean up any resources.
close
in interface AutoCloseable
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.