Package com.mongodb.internal.session
Class ClientSessionContext
- java.lang.Object
-
- com.mongodb.internal.session.ClientSessionContext
-
- All Implemented Interfaces:
SessionContext
public abstract class ClientSessionContext extends java.lang.Object implements SessionContext
-
-
Constructor Summary
Constructors Constructor Description ClientSessionContext(ClientSession clientSession)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advanceClusterTime(BsonDocument clusterTime)
Advance the cluster time.void
advanceOperationTime(BsonTimestamp operationTime)
Advance the operation time.long
advanceTransactionNumber()
Advance the transaction number.ClientSession
getClientSession()
BsonDocument
getClusterTime()
Gets the current cluster time for this session context.BsonTimestamp
getOperationTime()
Gets the current operation time for this session contextBsonDocument
getSessionId()
Gets the session identifier if this context has a session backing it.long
getTransactionNumber()
Gets the current transaction number.boolean
hasSession()
Returns true if there is a true server session associated with this context.boolean
isCausallyConsistent()
Gets whether this context is associated with a causally consistent session.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.mongodb.session.SessionContext
getReadConcern, hasActiveTransaction, isImplicitSession, notifyMessageSent
-
-
-
-
Constructor Detail
-
ClientSessionContext
public ClientSessionContext(ClientSession clientSession)
-
-
Method Detail
-
getClientSession
public ClientSession getClientSession()
-
hasSession
public boolean hasSession()
Description copied from interface:SessionContext
Returns true if there is a true server session associated with this context.- Specified by:
hasSession
in interfaceSessionContext
- Returns:
- true if there is a true server session associated with this context.
-
getSessionId
public BsonDocument getSessionId()
Description copied from interface:SessionContext
Gets the session identifier if this context has a session backing it.- Specified by:
getSessionId
in interfaceSessionContext
- Returns:
- the session id
-
isCausallyConsistent
public boolean isCausallyConsistent()
Description copied from interface:SessionContext
Gets whether this context is associated with a causally consistent session.- Specified by:
isCausallyConsistent
in interfaceSessionContext
- Returns:
- true ift his context is associated with a causally consistent session
-
getTransactionNumber
public long getTransactionNumber()
Description copied from interface:SessionContext
Gets the current transaction number.- Specified by:
getTransactionNumber
in interfaceSessionContext
- Returns:
- the current transaction number
-
advanceTransactionNumber
public long advanceTransactionNumber()
Description copied from interface:SessionContext
Advance the transaction number.- Specified by:
advanceTransactionNumber
in interfaceSessionContext
- Returns:
- the next transaction number for the session
-
getOperationTime
public BsonTimestamp getOperationTime()
Description copied from interface:SessionContext
Gets the current operation time for this session context- Specified by:
getOperationTime
in interfaceSessionContext
- Returns:
- the current operation time, which may be null
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp operationTime)
Description copied from interface:SessionContext
Advance the operation time. If the current operation time is greater than the given operation time, this method has no effect.- Specified by:
advanceOperationTime
in interfaceSessionContext
- Parameters:
operationTime
- the new operation time time
-
getClusterTime
public BsonDocument getClusterTime()
Description copied from interface:SessionContext
Gets the current cluster time for this session context.- Specified by:
getClusterTime
in interfaceSessionContext
- Returns:
- the cluster time, which may be null
-
advanceClusterTime
public void advanceClusterTime(BsonDocument clusterTime)
Description copied from interface:SessionContext
Advance the cluster time. If the current cluster time is greater than the given cluster time, this method has no effect.- Specified by:
advanceClusterTime
in interfaceSessionContext
- Parameters:
clusterTime
- the new cluster time
-
-