Class ReplicaSetStatus
- java.lang.Object
-
- com.mongodb.event.ServerMonitorListenerAdapter
-
- org.apache.jackrabbit.oak.plugins.document.mongo.ReplicaSetStatus
-
- All Implemented Interfaces:
com.mongodb.event.ServerMonitorListener
,EventListener
public class ReplicaSetStatus extends com.mongodb.event.ServerMonitorListenerAdapter
Keeps track of the status of a replica set based on information provided by heartbeat events. This status provides a replica set lag estimate, which can be used to decide whether secondaries are sufficiently up-to-date and read operations can be sent to a secondary. This is particularly useful when causal consistent client sessions are used with the MongoDB Java driver. Read operations shouldn't be sent to a secondary when it lags too much behind, otherwise the read operation will block until it was able to catch up.
-
-
Field Summary
Fields Modifier and Type Field Description static long
UNKNOWN_LAG
-
Constructor Summary
Constructors Constructor Description ReplicaSetStatus()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getLagEstimate()
void
serverHeartbeatSucceeded(com.mongodb.event.ServerHeartbeatSucceededEvent event)
-
-
-
Field Detail
-
UNKNOWN_LAG
public static final long UNKNOWN_LAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
serverHeartbeatSucceeded
public void serverHeartbeatSucceeded(com.mongodb.event.ServerHeartbeatSucceededEvent event)
- Specified by:
serverHeartbeatSucceeded
in interfacecom.mongodb.event.ServerMonitorListener
- Overrides:
serverHeartbeatSucceeded
in classcom.mongodb.event.ServerMonitorListenerAdapter
-
getLagEstimate
public long getLagEstimate()
-
-