Package com.mongodb.internal.connection
Class ClusterClockAdvancingSessionContext
- java.lang.Object
-
- com.mongodb.internal.connection.ClusterClockAdvancingSessionContext
-
- All Implemented Interfaces:
SessionContext
public final class ClusterClockAdvancingSessionContext extends java.lang.Object implements SessionContext
-
-
Constructor Summary
Constructors Constructor Description ClusterClockAdvancingSessionContext(SessionContext wrapped, ClusterClock clusterClock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvanceClusterTime(BsonDocument clusterTime)Advance the cluster time.voidadvanceOperationTime(BsonTimestamp operationTime)Advance the operation time.longadvanceTransactionNumber()Advance the transaction number.BsonDocumentgetClusterTime()Gets the current cluster time for this session context.BsonTimestampgetOperationTime()Gets the current operation time for this session contextReadConcerngetReadConcern()Gets the read concern to apply to operations on this binding.BsonDocumentgetSessionId()Gets the session identifier if this context has a session backing it.longgetTransactionNumber()Gets the current transaction number.booleanhasActiveTransaction()Gets whether the session has an active transactionbooleanhasSession()Returns true if there is a true server session associated with this context.booleanisCausallyConsistent()Gets whether this context is associated with a causally consistent session.booleanisImplicitSession()Returns true if the session is implicit, and false if the application started the session explicity.booleanisSessionMarkedDirty()Whether the server session is marked dirty.voidmarkSessionDirty()Mark the session as dirty.booleannotifyMessageSent()Notify the session context that a message has been sent.voidsetRecoveryToken(BsonDocument recoveryToken)Sets the recovery token in the session.voidunpinServerAddress()Unpin a mongos from a session.
-
-
-
Constructor Detail
-
ClusterClockAdvancingSessionContext
public ClusterClockAdvancingSessionContext(SessionContext wrapped, ClusterClock clusterClock)
-
-
Method Detail
-
hasSession
public boolean hasSession()
Description copied from interface:SessionContextReturns true if there is a true server session associated with this context.- Specified by:
hasSessionin interfaceSessionContext- Returns:
- true if there is a true server session associated with this context.
-
isImplicitSession
public boolean isImplicitSession()
Description copied from interface:SessionContextReturns true if the session is implicit, and false if the application started the session explicity.- Specified by:
isImplicitSessionin interfaceSessionContext- Returns:
- true if the session is implicit
-
getSessionId
public BsonDocument getSessionId()
Description copied from interface:SessionContextGets the session identifier if this context has a session backing it.- Specified by:
getSessionIdin interfaceSessionContext- Returns:
- the session id
-
isCausallyConsistent
public boolean isCausallyConsistent()
Description copied from interface:SessionContextGets whether this context is associated with a causally consistent session.- Specified by:
isCausallyConsistentin interfaceSessionContext- Returns:
- true ift his context is associated with a causally consistent session
-
getTransactionNumber
public long getTransactionNumber()
Description copied from interface:SessionContextGets the current transaction number.- Specified by:
getTransactionNumberin interfaceSessionContext- Returns:
- the current transaction number
-
advanceTransactionNumber
public long advanceTransactionNumber()
Description copied from interface:SessionContextAdvance the transaction number.- Specified by:
advanceTransactionNumberin interfaceSessionContext- Returns:
- the next transaction number for the session
-
notifyMessageSent
public boolean notifyMessageSent()
Description copied from interface:SessionContextNotify the session context that a message has been sent.- Specified by:
notifyMessageSentin interfaceSessionContext- Returns:
- true if this is the first message sent, false otherwise
-
getOperationTime
public BsonTimestamp getOperationTime()
Description copied from interface:SessionContextGets the current operation time for this session context- Specified by:
getOperationTimein interfaceSessionContext- Returns:
- the current operation time, which may be null
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp operationTime)
Description copied from interface:SessionContextAdvance the operation time. If the current operation time is greater than the given operation time, this method has no effect.- Specified by:
advanceOperationTimein interfaceSessionContext- Parameters:
operationTime- the new operation time time
-
getClusterTime
public BsonDocument getClusterTime()
Description copied from interface:SessionContextGets the current cluster time for this session context.- Specified by:
getClusterTimein interfaceSessionContext- Returns:
- the cluster time, which may be null
-
advanceClusterTime
public void advanceClusterTime(BsonDocument clusterTime)
Description copied from interface:SessionContextAdvance the cluster time. If the current cluster time is greater than the given cluster time, this method has no effect.- Specified by:
advanceClusterTimein interfaceSessionContext- Parameters:
clusterTime- the new cluster time
-
hasActiveTransaction
public boolean hasActiveTransaction()
Description copied from interface:SessionContextGets whether the session has an active transaction- Specified by:
hasActiveTransactionin interfaceSessionContext- Returns:
- true if the session has an active transaction
-
getReadConcern
public ReadConcern getReadConcern()
Description copied from interface:SessionContextGets the read concern to apply to operations on this binding.- Specified by:
getReadConcernin interfaceSessionContext- Returns:
- the read concern to apply to operations on this binding
-
setRecoveryToken
public void setRecoveryToken(BsonDocument recoveryToken)
Description copied from interface:SessionContextSets the recovery token in the session.- Specified by:
setRecoveryTokenin interfaceSessionContext- Parameters:
recoveryToken- the recovery token
-
unpinServerAddress
public void unpinServerAddress()
Description copied from interface:SessionContextUnpin a mongos from a session.- Specified by:
unpinServerAddressin interfaceSessionContext
-
markSessionDirty
public void markSessionDirty()
Description copied from interface:SessionContextMark the session as dirty. This happens when a command fails with a network error. Dirty sessions are later discarded from the server session pool.- Specified by:
markSessionDirtyin interfaceSessionContext
-
isSessionMarkedDirty
public boolean isSessionMarkedDirty()
Description copied from interface:SessionContextWhether the server session is marked dirty.- Specified by:
isSessionMarkedDirtyin interfaceSessionContext- Returns:
- true if the session has been marked dirty
-
-