public class DefaultIndexTrackingPoller extends Object implements IndexTrackingPoller
| Constructor and Description |
|---|
DefaultIndexTrackingPoller(MessageLog messageLog) |
| Modifier and Type | Method and Description |
|---|---|
long |
entryId()
Returns the current entry ID of this poller.
|
long |
index()
Returns the current index of this poller.
|
boolean |
moveTo(long entryId) |
MessageLog.Poller |
moveToEnd()
NOTE: this method is possibly slow if it has to move a lot of positions!
Moves to the end of the message log.
|
boolean |
moveToIndex(long index)
NOTE: this method is possibly slow if it has to move a lot of positions!
Moves to the specified index
|
boolean |
moveToNext() |
boolean |
moveToPrevious() |
DefaultIndexTrackingPoller |
moveToStart() |
int |
poll(MessageLog.Handler handler) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreatepublic DefaultIndexTrackingPoller(MessageLog messageLog)
public long index()
IndexTrackingPollerIt returns the index of the message currently polled if invoked while polling a message. Otherwise it returns the index of the next message to be polled.
The index monotonically increasing and gap free.
index in interface IndexTrackingPollerpublic long entryId()
MessageLog.PollerIt returns the entry ID of the message currently polled if invoked while polling a message. Otherwise it returns the entry ID of the next message to be polled.
The index is monotonically increasing but not necessarily gap free; for instance for a chronicle message log the entry ID consists of cycle and the sequence number within that cycle.
entryId in interface MessageLog.Pollerpublic boolean moveTo(long entryId)
moveTo in interface MessageLog.Pollerpublic boolean moveToIndex(long index)
IndexTrackingPollermoveToIndex in interface IndexTrackingPollerindex - the index to move to, valid from zero to (#entries - 1)public boolean moveToNext()
moveToNext in interface MessageLog.Pollerpublic boolean moveToPrevious()
moveToPrevious in interface MessageLog.Pollerpublic DefaultIndexTrackingPoller moveToStart()
moveToStart in interface MessageLog.Pollerpublic MessageLog.Poller moveToEnd()
IndexTrackingPollermoveToEnd in interface IndexTrackingPollermoveToEnd in interface MessageLog.Pollerpublic int poll(MessageLog.Handler handler)
poll in interface MessageLog.PollerCopyright © 2020 tools4j.org (Marco Terzer, Anton Anufriev). All Rights Reserved.