public class ClusterNodeIndexCounterManager extends IndexCounterManager
Decouples internal reporting of current state of replication of other nodes index operations from status reported to the DB.
NodeIndexCounter changes reported by storeHighestIdForNode(String, long)
are buffered and are not saved to persistent storage
until commit operation is explicitly called.
The commit operation is two step, and is expected to be part of IndexWriter atomic save to disk operation.
Constructor and Description |
---|
ClusterNodeIndexCounterManager(OfBizNodeIndexCounterStore ofBizNodeIndexCounterStore,
ClusterManager clusterManager) |
Modifier and Type | Method and Description |
---|---|
long |
getIndexOperationCounterForNodeId(String sendingNodeId)
If local cache contains operation for given sendingNodeId returns it, otherwise returns it from the database
|
void |
onAfterCommit()
Attempts to persist latest operation ids to indexCounterStore .
|
void |
onBeforeCommit()
Copies the buffer of latest replicated operations for each node to working buffer.
|
void |
storeHighestIdForNode(String sendingNodeId,
long indexOperationId)
Stores given operationId in local cache until next
onAfterCommit() is completed. |
public ClusterNodeIndexCounterManager(OfBizNodeIndexCounterStore ofBizNodeIndexCounterStore, ClusterManager clusterManager)
public void storeHighestIdForNode(String sendingNodeId, long indexOperationId)
onAfterCommit()
is completed.sendingNodeId
- - id of node that generated the operatonindexOperationId
- public long getIndexOperationCounterForNodeId(String sendingNodeId)
sendingNodeId
- - id of node that generated the operationpublic void onBeforeCommit()
onAfterCommit()
Warning: this method is not thread safe and should be called withing one thread along with onAfterCommit()
.public void onAfterCommit()
onBeforeCommit()
.
If the process is interrupted by an exception, the saved node operations are removed from the local cache, while others remain until the next call.
Warning: this method is not thread safe and should be called within one thread along with onBeforeCommit()
.Copyright © 2002-2023 Atlassian. All Rights Reserved.