public class RingbufferMapEventJournalImpl extends Object implements MapEventJournal
Ringbuffer.
It will add all journal events into a RingbufferContainer with the provided namespace
and partition ID and allows checking if the map has a configured event journal.
Adapts the EventJournalConfig to the RingbufferConfig when creating the ringbuffer.| Constructor and Description |
|---|
RingbufferMapEventJournalImpl(NodeEngine engine) |
| 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<InternalEventJournalMapEvent,T> resultSet)
Reads events from the journal in batches.
|
RingbufferConfig |
toRingbufferConfig(EventJournalConfig config) |
void |
writeAddEvent(ObjectNamespace namespace,
int partitionId,
Data key,
Object value)
Writes an
EntryEventType.ADDED to the event journal. |
void |
writeEvictEvent(ObjectNamespace namespace,
int partitionId,
Data key,
Object value)
Writes an
EntryEventType.EVICTED to the event journal. |
void |
writeRemoveEvent(ObjectNamespace namespace,
int partitionId,
Data key,
Object value)
Writes an
EntryEventType.REMOVED to the event journal. |
void |
writeUpdateEvent(ObjectNamespace namespace,
int partitionId,
Data key,
Object oldValue,
Object newValue)
Writes an
EntryEventType.UPDATED to the event journal. |
public RingbufferMapEventJournalImpl(NodeEngine engine)
public void writeUpdateEvent(ObjectNamespace namespace, int partitionId, Data key, Object oldValue, Object newValue)
MapEventJournalEntryEventType.UPDATED to the event journal.
If there is no event journal configured for this map, the method will do nothing.
If an event is added to the event journal, all parked operations waiting for
new events on that journal will be unparked.writeUpdateEvent in interface MapEventJournalnamespace - the map namespacepartitionId - the entry key partitionkey - the entry keyoldValue - the old valuenewValue - the new valuepublic void writeAddEvent(ObjectNamespace namespace, int partitionId, Data key, Object value)
MapEventJournalEntryEventType.ADDED to the event journal.
If there is no event journal configured for this map, the method will do nothing.
If an event is added to the event journal, all parked operations waiting for
new events on that journal will be unparked.writeAddEvent in interface MapEventJournalnamespace - the map namespacepartitionId - the entry key partitionkey - the entry keyvalue - the entry valuepublic void writeRemoveEvent(ObjectNamespace namespace, int partitionId, Data key, Object value)
MapEventJournalEntryEventType.REMOVED to the event journal.
If there is no event journal configured for this map, the method will do nothing.
If an event is added to the event journal, all parked operations waiting for
new events on that journal will be unparked.writeRemoveEvent in interface MapEventJournalnamespace - the map namespacepartitionId - the entry key partitionkey - the entry keyvalue - the entry valuepublic void writeEvictEvent(ObjectNamespace namespace, int partitionId, Data key, Object value)
MapEventJournalEntryEventType.EVICTED to the event journal.
If there is no event journal configured for this map, the method will do nothing.
If an event is added to the event journal, all parked operations waiting for
new events on that journal will be unparked.writeEvictEvent in interface MapEventJournalnamespace - the map namespacepartitionId - the entry key partitionkey - the entry keyvalue - the entry valuepublic long newestSequence(ObjectNamespace namespace, int partitionId)
EventJournalnewestSequence in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the event journalpublic long oldestSequence(ObjectNamespace namespace, int partitionId)
EventJournaloldestSequence in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the event journalpublic void destroy(ObjectNamespace namespace, int partitionId)
EventJournaldestroy in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the entries in the journalpublic void isAvailableOrNextSequence(ObjectNamespace namespace, int partitionId, long sequence)
EventJournalEventJournal.newestSequence(ObjectNamespace, int), the caller can use this method
to check the sequence before performing a possibly blocking read.isAvailableOrNextSequence in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the entries in the journalsequence - the sequence wanting to be readpublic boolean isNextAvailableSequence(ObjectNamespace namespace, int partitionId, long sequence)
EventJournalsequence is the sequence of the next event to
be added to the event journal.isNextAvailableSequence in interface EventJournal<InternalEventJournalMapEvent>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 otherwisepublic WaitNotifyKey getWaitNotifyKey(ObjectNamespace namespace, int partitionId)
EventJournalWaitNotifyKey for objects waiting and notifying on the event journal.getWaitNotifyKey in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the entries in the journalpublic <T> long readMany(ObjectNamespace namespace, int partitionId, long beginSequence, ReadResultSetImpl<InternalEventJournalMapEvent,T> resultSet)
EventJournalReadResultSetImpl.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.
readMany in interface EventJournal<InternalEventJournalMapEvent>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 eventsEventJournal.isAvailableOrNextSequence(ObjectNamespace, int, long)public void cleanup(ObjectNamespace namespace, int partitionId)
EventJournalcleanup in interface EventJournal<InternalEventJournalMapEvent>namespace - the object namespacepartitionId - the partition ID of the entries in the journalpublic boolean hasEventJournal(ObjectNamespace namespace)
MapEventJournaltrue if the object has a configured and enabled event journal.hasEventJournal in interface EventJournal<InternalEventJournalMapEvent>hasEventJournal in interface MapEventJournalnamespace - the object namespacetrue if the object has a configured and enabled event journal, false otherwisepublic EventJournalConfig getEventJournalConfig(ObjectNamespace namespace)
getEventJournalConfig in interface EventJournal<InternalEventJournalMapEvent>public RingbufferConfig toRingbufferConfig(EventJournalConfig config)
toRingbufferConfig in interface EventJournal<InternalEventJournalMapEvent>Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.