protected static class LoggedBookmarkStore.Subscription extends java.lang.Object implements Subscription
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
_recoveryTimestamp
The last-modified timestamp of the backing bookmark log file, just
before recovery is initiated.
|
Constructor and Description |
---|
Subscription() |
Modifier and Type | Method and Description |
---|---|
void |
discard(long index)
Discards an entry in the bookmark ring buffer and updates the status
accordingly.
|
Field |
getLastPersisted()
Retrieves the last persisted bookmark
|
Field |
getMostRecent()
Retrieves the most recent bookmark.
|
protected Field |
getMostRecent(boolean updateRecovery_)
Retrieves the most recent bookmark with an option to update recovery status.
|
Field |
getMostRecentList(boolean useList) |
long |
getOldestBookmarkSeq()
Retrieves the sequence number of the oldest bookmark in the subscription's
bookmark ring buffer.
|
BookmarkRangeField |
getRange()
Retrieves the current bookmark range.
|
java.lang.String |
getRecoveryTimestamp()
Get the recovery timestamp associated with this message.
|
void |
init(Field subscriptionId,
LoggedBookmarkStore parent)
Initializes the subscription with the given subscription ID and the parent
LoggedBookmarkStore.
|
boolean |
isDiscarded(BookmarkField bookmark)
Check to see if this message is older than the most recent one seen,
and if it is, then check to see if it is discarded.
|
boolean |
justRecovered()
Call on a Subscription object just after recovery is performed to
convert logged entries into recovery entries and set the publishers
cache state to the earliest sequence seen for each publisher minus
one.
|
long |
log(BookmarkField bookmark)
This is a method the Client calls and is not for customer user.
|
void |
reset()
Reset the state of this subscription object such that it can be
returned to the pool for reuse.
|
void |
setLastPersisted(BookmarkField bookmark)
Sets the last persisted bookmark using a provided BookmarkField object.
|
void |
setLastPersisted(long bookmark)
Deprecated.
Use
setLastPersisted(BookmarkField) instead. |
static void |
setPublishersToDiscarded(java.util.List<BookmarkRingBuffer.Entry> active,
java.util.Map<java.lang.Long,java.lang.Long> publishers)
Update the provided publishers map with the highest sequence number
that has been discarded for each publisher based on the given list of
active bookmark entries.
|
protected void |
setRecoveryTimestamp(java.lang.String rts)
Sets the recovery timestamp associated with this message.
|
void |
setResizeHandler(BookmarkStoreResizeHandler handler,
BookmarkStore store)
Sets the resize handler for the bookmark store.
|
protected volatile java.lang.String _recoveryTimestamp
public void reset()
public void init(Field subscriptionId, LoggedBookmarkStore parent)
subscriptionId
- The ID of the subscription to initialize.parent
- The parent LoggedBookmarkStore to associate with this
subscription.public java.lang.String getRecoveryTimestamp()
protected final void setRecoveryTimestamp(java.lang.String rts)
rts
- The recovery timestamp to be set.public long log(BookmarkField bookmark) throws java.io.IOException, CommandException
log
in interface Subscription
bookmark
- The bookmark to log.java.io.IOException
- If there is an I/O error during logging.CommandException
- Thrown when an invalid bookmark range is specified.public void discard(long index) throws java.io.IOException
discard
in interface Subscription
index
- The index of the entry to discard.java.io.IOException
- If there is an I/O error during the discard operation.public boolean isDiscarded(BookmarkField bookmark) throws java.io.IOException
isDiscarded
in interface Subscription
bookmark
- The bookmark to check for discard status.java.io.IOException
- If there is an I/O error during the check.public Field getLastPersisted()
public BookmarkRangeField getRange()
getRange
in interface Subscription
public Field getMostRecent()
getMostRecent
in interface Subscription
protected Field getMostRecent(boolean updateRecovery_)
updateRecovery_
- Whether to update the recovery status before
retrieving the most recent bookmark.public Field getMostRecentList(boolean useList)
getMostRecentList
in interface Subscription
@Deprecated public void setLastPersisted(long bookmark) throws java.io.IOException
setLastPersisted(BookmarkField)
instead.setLastPersisted
in interface Subscription
bookmark
- The sequence number of the bookmark (no longer used).java.io.IOException
- If an I/O error occurs.public void setLastPersisted(BookmarkField bookmark) throws java.io.IOException
setLastPersisted
in interface Subscription
bookmark
- The BookmarkField object representing the last persisted
bookmark.java.io.IOException
- If an I/O error occurs.public long getOldestBookmarkSeq()
getOldestBookmarkSeq
in interface Subscription
public boolean justRecovered()
public static void setPublishersToDiscarded(java.util.List<BookmarkRingBuffer.Entry> active, java.util.Map<java.lang.Long,java.lang.Long> publishers)
active
- A list of active bookmark entries to consider for
updating the publishers' highest discarded sequence
numbers.publishers
- A map that associates publisher IDs with their highest
discarded sequence numbers. This map will be updated
with the latest discarded sequence numbers for each
publisher.public void setResizeHandler(BookmarkStoreResizeHandler handler, BookmarkStore store)
setResizeHandler
in interface Subscription
handler
- The `BookmarkStoreResizeHandler` responsible for handling file
size management.store
- The `BookmarkStore` associated with the resize handler.