protected class RepositoryChangeBus.ChangeSetListenerConsumerAdapter extends Object implements RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>
Modifier | Constructor and Description |
---|---|
protected |
ChangeSetListenerConsumerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
close(ChangeSetListener consumer)
Called by the
RingBuffer when the RingBuffer.ConsumerAdapter.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(ChangeSetListener consumer,
ChangeSet event,
long position,
long maxPosition)
Consume an entry from the ring buffer.
|
void |
handleException(ChangeSetListener consumer,
Throwable t,
ChangeSet entry,
long position,
long maxPosition)
Handle an exception that was thrown from the
RingBuffer.ConsumerAdapter.consume(Object, Object, long, long) . |
public boolean consume(ChangeSetListener consumer, ChangeSet event, long position, long maxPosition)
RingBuffer.ConsumerAdapter
RingBuffer.ConsumerAdapter.handleException(Object, Throwable, Object, long, long)
being called.consume
in interface RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>
consumer
- the consumer instance that is to consume the event; never nullevent
- 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 usedpublic void close(ChangeSetListener consumer)
RingBuffer.ConsumerAdapter
RingBuffer
when the RingBuffer.ConsumerAdapter.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
close
in interface RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>
consumer
- the consumer instance that is being closed; never nullpublic void handleException(ChangeSetListener consumer, Throwable t, ChangeSet entry, long position, long maxPosition)
RingBuffer.ConsumerAdapter
RingBuffer.ConsumerAdapter.consume(Object, Object, long, long)
.handleException
in interface RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>
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.