Package com.mongodb.internal.session
Class BaseClientSessionImpl
- java.lang.Object
-
- com.mongodb.internal.session.BaseClientSessionImpl
-
- All Implemented Interfaces:
ClientSession,java.io.Closeable,java.lang.AutoCloseable
public class BaseClientSessionImpl extends java.lang.Object implements ClientSession
-
-
Constructor Summary
Constructors Constructor Description BaseClientSessionImpl(ServerSessionPool serverSessionPool, java.lang.Object originator, ClientSessionOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvanceClusterTime(BsonDocument newClusterTime)voidadvanceOperationTime(BsonTimestamp newOperationTime)Set the operation time of the last operation executed in this session.voidclose()BsonDocumentgetClusterTime()BsonTimestampgetOperationTime()Gets the operation time of the last operation executed in this session.ClientSessionOptionsgetOptions()Get the options for this session.java.lang.ObjectgetOriginator()Gets the originator for the session.ServerAddressgetPinnedServerAddress()Get the server address of the pinned mongos on this session.BsonDocumentgetRecoveryToken()Get the recovery token from the latest outcome in a sharded transaction.ServerSessiongetServerSession()booleanisCausallyConsistent()Returns true if operations in this session must be causally consistentvoidsetPinnedServerAddress(ServerAddress address)Set the server address of the pinned mongos.voidsetRecoveryToken(BsonDocument recoveryToken)Set the recovery token.
-
-
-
Constructor Detail
-
BaseClientSessionImpl
public BaseClientSessionImpl(ServerSessionPool serverSessionPool, java.lang.Object originator, ClientSessionOptions options)
-
-
Method Detail
-
getPinnedServerAddress
@Nullable public ServerAddress getPinnedServerAddress()
Description copied from interface:ClientSessionGet the server address of the pinned mongos on this session. For internal use only.- Specified by:
getPinnedServerAddressin interfaceClientSession- Returns:
- the server address of the pinned mongos
-
setPinnedServerAddress
public void setPinnedServerAddress(@Nullable ServerAddress address)Description copied from interface:ClientSessionSet the server address of the pinned mongos. For internal use only.- Specified by:
setPinnedServerAddressin interfaceClientSession- Parameters:
address- the server address to pin
-
getRecoveryToken
public BsonDocument getRecoveryToken()
Description copied from interface:ClientSessionGet the recovery token from the latest outcome in a sharded transaction. For internal use only.- Specified by:
getRecoveryTokenin interfaceClientSession- Returns:
- the recovery token
-
setRecoveryToken
public void setRecoveryToken(BsonDocument recoveryToken)
Description copied from interface:ClientSessionSet the recovery token. For internal use only.- Specified by:
setRecoveryTokenin interfaceClientSession- Parameters:
recoveryToken- the recovery token
-
getOptions
public ClientSessionOptions getOptions()
Description copied from interface:ClientSessionGet the options for this session.- Specified by:
getOptionsin interfaceClientSession- Returns:
- the options, which may not be null
-
isCausallyConsistent
public boolean isCausallyConsistent()
Description copied from interface:ClientSessionReturns true if operations in this session must be causally consistent- Specified by:
isCausallyConsistentin interfaceClientSession- Returns:
- whether operations in this session must be causally consistent.
-
getOriginator
public java.lang.Object getOriginator()
Description copied from interface:ClientSessionGets the originator for the session.Important because sessions must only be used by their own originator.
- Specified by:
getOriginatorin interfaceClientSession- Returns:
- the sessions originator
-
getClusterTime
public BsonDocument getClusterTime()
- Specified by:
getClusterTimein interfaceClientSession- Returns:
- the latest cluster time seen by this session
-
getOperationTime
public BsonTimestamp getOperationTime()
Description copied from interface:ClientSessionGets the operation time of the last operation executed in this session.- Specified by:
getOperationTimein interfaceClientSession- Returns:
- the operation time
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSessionin interfaceClientSession- Returns:
- the server session
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp newOperationTime)
Description copied from interface:ClientSessionSet the operation time of the last operation executed in this session.- Specified by:
advanceOperationTimein interfaceClientSession- Parameters:
newOperationTime- the operation time
-
advanceClusterTime
public void advanceClusterTime(BsonDocument newClusterTime)
- Specified by:
advanceClusterTimein interfaceClientSession- Parameters:
newClusterTime- the cluster time to advance to
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceClientSession- Specified by:
closein interfacejava.io.Closeable
-
-