Package com.mongodb.session
Interface ClientSession
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Subinterfaces:
ClientSession
- All Known Implementing Classes:
BaseClientSessionImpl
@NotThreadSafe public interface ClientSession extends java.io.Closeable
A client session.- Since:
- 3.6
- See Also:
ClientSessionOptions
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadvanceClusterTime(BsonDocument clusterTime)voidadvanceOperationTime(BsonTimestamp operationTime)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.ServerSessiongetServerSession()booleanisCausallyConsistent()Returns true if operations in this session must be causally consistent
-
-
-
Method Detail
-
getOptions
ClientSessionOptions getOptions()
Get the options for this session.- Returns:
- the options, which may not be null
-
isCausallyConsistent
boolean isCausallyConsistent()
Returns true if operations in this session must be causally consistent- Returns:
- whether operations in this session must be causally consistent.
-
getOriginator
java.lang.Object getOriginator()
Gets the originator for the session.Important because sessions must only be used by their own originator.
- Returns:
- the sessions originator
-
getServerSession
ServerSession getServerSession()
- Returns:
- the server session
-
getOperationTime
BsonTimestamp getOperationTime()
Gets the operation time of the last operation executed in this session.- Returns:
- the operation time
-
advanceOperationTime
void advanceOperationTime(BsonTimestamp operationTime)
Set the operation time of the last operation executed in this session.- Parameters:
operationTime- the operation time
-
advanceClusterTime
void advanceClusterTime(BsonDocument clusterTime)
- Parameters:
clusterTime- the cluster time to advance to
-
getClusterTime
BsonDocument getClusterTime()
- Returns:
- the latest cluster time seen by this session
-
close
void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-