Package com.mongodb.client
Interface ClientSession
- 
- All Superinterfaces:
 java.lang.AutoCloseable,ClientSession,java.io.Closeable
@Deprecated(since="2021-05-27") public interface ClientSession extends ClientSession
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.A client session that supports transactions.- Since:
 - 3.8
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidabortTransaction()Deprecated.Abort a transaction in the context of this session.voidcommitTransaction()Deprecated.Commit a transaction in the context of this session.ServerAddressgetPinnedServerAddress()Deprecated.Returns the server address of the pinned mongos on this session.TransactionOptionsgetTransactionOptions()Deprecated.Gets the transaction options.booleanhasActiveTransaction()Deprecated.Returns true if there is an active transaction on this session, and false otherwisebooleannotifyMessageSent()Deprecated.Notify the client session that a message has been sent.voidsetPinnedServerAddress(ServerAddress address)Deprecated.Pin the server address of the mongos on this session.voidstartTransaction()Deprecated.Start a transaction in the context of this session with default transaction options.voidstartTransaction(TransactionOptions transactionOptions)Deprecated.Start a transaction in the context of this session with the given transaction options.<T> TwithTransaction(TransactionBody<T> transactionBody)Deprecated.Execute the given function within a transaction.<T> TwithTransaction(TransactionBody<T> transactionBody, TransactionOptions options)Deprecated.Execute the given function within a transaction.- 
Methods inherited from interface com.mongodb.session.ClientSession
advanceClusterTime, advanceOperationTime, close, getClusterTime, getOperationTime, getOptions, getOriginator, getRecoveryToken, getServerSession, isCausallyConsistent, setRecoveryToken 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getPinnedServerAddress
@Nullable ServerAddress getPinnedServerAddress()
Deprecated.Returns the server address of the pinned mongos on this session.- Specified by:
 getPinnedServerAddressin interfaceClientSession- Returns:
 - the server address of the pinned mongos.
 - Since:
 - 3.11
 
 
- 
setPinnedServerAddress
void setPinnedServerAddress(@Nullable ServerAddress address)Deprecated.Pin the server address of the mongos on this session.- Specified by:
 setPinnedServerAddressin interfaceClientSession- Parameters:
 address- the server address to pin to this session- Since:
 - 3.11
 
 
- 
hasActiveTransaction
boolean hasActiveTransaction()
Deprecated.Returns true if there is an active transaction on this session, and false otherwise- Returns:
 - true if there is an active transaction on this session
 
 
- 
notifyMessageSent
boolean notifyMessageSent()
Deprecated.Notify the client session that a message has been sent.For internal use only
- Returns:
 - true if this is the first message sent, false otherwise
 
 
- 
getTransactionOptions
TransactionOptions getTransactionOptions()
Deprecated.Gets the transaction options. Only call this method of the session has an active transaction- Returns:
 - the transaction options
 
 
- 
startTransaction
void startTransaction()
Deprecated.Start a transaction in the context of this session with default transaction options. A transaction can not be started if there is already an active transaction on this session. 
- 
startTransaction
void startTransaction(TransactionOptions transactionOptions)
Deprecated.Start a transaction in the context of this session with the given transaction options. A transaction can not be started if there is already an active transaction on this session.- Parameters:
 transactionOptions- the options to apply to the transaction
 
- 
commitTransaction
void commitTransaction()
Deprecated.Commit a transaction in the context of this session. A transaction can only be commmited if one has first been started. 
- 
abortTransaction
void abortTransaction()
Deprecated.Abort a transaction in the context of this session. A transaction can only be aborted if one has first been started. 
- 
withTransaction
<T> T withTransaction(TransactionBody<T> transactionBody)
Deprecated.Execute the given function within a transaction.- Type Parameters:
 T- the return type of the transaction body- Parameters:
 transactionBody- the body of the transaction- Returns:
 - the return value of the transaction body
 - Since:
 - 3.11
 
 
- 
withTransaction
<T> T withTransaction(TransactionBody<T> transactionBody, TransactionOptions options)
Deprecated.Execute the given function within a transaction.- Type Parameters:
 T- the return type of the transaction body- Parameters:
 transactionBody- the body of the transactionoptions- the transaction options- Returns:
 - the return value of the transaction body
 - Since:
 - 3.11
 
 
 - 
 
 -