public interface PartitionSequencer
Each partition has its own sequence-number on publisher-side. For every generated event, this sequence will be incremented by one and set to that event before sending it to the subscriber side.
On subscriber side, this sequence is used to keep track of published events; upon arrival of an event, there is a pre-condition check to decide whether that the arrived event has the next-expected-sequence-number for the relevant partition. If the event has next-sequence, it is applied to the query-cache.
Implementations of this interface should be thread-safe.
Modifier and Type | Method and Description |
---|---|
boolean |
compareAndSetSequence(long expect,
long update)
Atomically sets the value of sequence number for the partition.
|
long |
getSequence()
Returns current sequence number of the partition.
|
long |
nextSequence()
Returns next number in sequence for the partition.
|
void |
reset()
Resets
PartitionSequencer . |
void |
setSequence(long update)
Sets the current sequence number for the partition.
|
long nextSequence()
void setSequence(long update)
update
- new sequence number.boolean compareAndSetSequence(long expect, long update)
expect
- the expected sequence.update
- the new sequence.true
if Compare-and-Set operation is successful, otherwise returns false
.long getSequence()
void reset()
PartitionSequencer
.
After this call returns sequence generation will be start from zero.Copyright © 2019 Hazelcast, Inc.. All rights reserved.