E
- journal event typepublic interface EventJournal<E>
If a object is destroyed or the migrated, the related event journal will be destroyed or migrated as well. In this sense, the event journal is co-located with the object partition and it's replicas.
Modifier and Type | Method and Description |
---|---|
void |
cleanup(ObjectNamespace namespace,
int partitionId)
Cleans up the event journal by removing any expired items.
|
void |
destroy(ObjectNamespace namespace,
int partitionId)
Destroys the event journal for the given object and partition ID.
|
EventJournalConfig |
getEventJournalConfig(ObjectNamespace namespace) |
WaitNotifyKey |
getWaitNotifyKey(ObjectNamespace namespace,
int partitionId)
Return the
WaitNotifyKey for objects waiting and notifying on the event journal. |
boolean |
hasEventJournal(ObjectNamespace namespace)
Returns
true if the object has a configured and enabled event journal. |
void |
isAvailableOrNextSequence(ObjectNamespace namespace,
int partitionId,
long sequence)
Checks if the sequence is of an item that can be read immediately
or is the sequence of the next item to be added into the event journal.
|
boolean |
isNextAvailableSequence(ObjectNamespace namespace,
int partitionId,
long sequence)
Checks if the
sequence is the sequence of the next event to
be added to the event journal. |
long |
newestSequence(ObjectNamespace namespace,
int partitionId)
Returns the sequence of the newest event stored in the event journal.
|
long |
oldestSequence(ObjectNamespace namespace,
int partitionId)
Returns the sequence of the oldest event stored in the event journal.
|
<T> long |
readMany(ObjectNamespace namespace,
int partitionId,
long beginSequence,
ReadResultSetImpl<E,T> resultSet)
Reads events from the journal in batches.
|
RingbufferConfig |
toRingbufferConfig(EventJournalConfig config) |
long newestSequence(ObjectNamespace namespace, int partitionId)
namespace
- the object namespacepartitionId
- the partition ID of the event journalIllegalStateException
- if there is no event journal configured for this objectlong oldestSequence(ObjectNamespace namespace, int partitionId)
namespace
- the object namespacepartitionId
- the partition ID of the event journalIllegalStateException
- if there is no event journal configured for this objectvoid destroy(ObjectNamespace namespace, int partitionId)
namespace
- the object namespacepartitionId
- the partition ID of the entries in the journalvoid isAvailableOrNextSequence(ObjectNamespace namespace, int partitionId, long sequence)
newestSequence(ObjectNamespace, int)
, the caller can use this method
to check the sequence before performing a possibly blocking read.namespace
- the object namespacepartitionId
- the partition ID of the entries in the journalsequence
- the sequence wanting to be readStaleSequenceException
- if the requested sequence is smaller than the
sequence of the oldest event (the sequence has
been overwritten)IllegalArgumentException
- if the requested sequence is greater than the
next available sequence + 1IllegalStateException
- if there is no event journal configured for this objectboolean isNextAvailableSequence(ObjectNamespace namespace, int partitionId, long sequence)
sequence
is the sequence of the next event to
be added to the event journal.namespace
- the object namespacepartitionId
- the partition ID of the entries in the journalsequence
- the sequence to be checkedtrue
if the sequence
is one greater
than the sequence of the last event, false
otherwiseIllegalStateException
- if there is no event journal configured for this objectWaitNotifyKey getWaitNotifyKey(ObjectNamespace namespace, int partitionId)
WaitNotifyKey
for objects waiting and notifying on the event journal.namespace
- the object namespacepartitionId
- the partition ID of the entries in the journalIllegalStateException
- if there is no event journal configured for this object<T> long readMany(ObjectNamespace namespace, int partitionId, long beginSequence, ReadResultSetImpl<E,T> resultSet)
ReadResultSetImpl.isMaxSizeReached()
or until the journal is exhausted. The resultSet
allows
filtering and projections on journal items so that the caller
can control which data is returned.
If the set has reached it's max size, the returned sequence one greater than the sequence of the last item in the set. In other cases it means that the set hasn't reached it's full size because we have reached the end of the event journal. In this case the returned sequence is one greater than the sequence of the last stored event.
T
- the return type of the projected eventsnamespace
- the object namespacepartitionId
- the partition ID of the entries in the journalbeginSequence
- the sequence of the first item to read.resultSet
- the container for read, filtered and projected eventsIllegalStateException
- if there is no event journal configured for this objectStaleSequenceException
- if the requested sequence is smaller than the sequence of the oldest eventIllegalArgumentException
- if the requested sequence is greater than the sequence of the newest event + 1isAvailableOrNextSequence(ObjectNamespace, int, long)
void cleanup(ObjectNamespace namespace, int partitionId)
namespace
- the object namespacepartitionId
- the partition ID of the entries in the journalIllegalStateException
- if there is no event journal configured for this objectboolean hasEventJournal(ObjectNamespace namespace)
true
if the object has a configured and enabled event journal.namespace
- the object namespacetrue
if the object has a configured and enabled event journal, false
otherwiseEventJournalConfig getEventJournalConfig(ObjectNamespace namespace)
RingbufferConfig toRingbufferConfig(EventJournalConfig config)
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.