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 void
advanceClusterTime(BsonDocument newClusterTime)
void
advanceOperationTime(BsonTimestamp newOperationTime)
Set the operation time of the last operation executed in this session.void
close()
BsonDocument
getClusterTime()
BsonTimestamp
getOperationTime()
Gets the operation time of the last operation executed in this session.ClientSessionOptions
getOptions()
Get the options for this session.java.lang.Object
getOriginator()
Gets the originator for the session.ServerSession
getServerSession()
boolean
isCausallyConsistent()
Returns true if operations in this session must be causally consistent
-
-
-
Constructor Detail
-
BaseClientSessionImpl
public BaseClientSessionImpl(ServerSessionPool serverSessionPool, java.lang.Object originator, ClientSessionOptions options)
-
-
Method Detail
-
getOptions
public ClientSessionOptions getOptions()
Description copied from interface:ClientSession
Get the options for this session.- Specified by:
getOptions
in interfaceClientSession
- Returns:
- the options, which may not be null
-
isCausallyConsistent
public boolean isCausallyConsistent()
Description copied from interface:ClientSession
Returns true if operations in this session must be causally consistent- Specified by:
isCausallyConsistent
in interfaceClientSession
- Returns:
- whether operations in this session must be causally consistent.
-
getOriginator
public java.lang.Object getOriginator()
Description copied from interface:ClientSession
Gets the originator for the session.Important because sessions must only be used by their own originator.
- Specified by:
getOriginator
in interfaceClientSession
- Returns:
- the sessions originator
-
getClusterTime
public BsonDocument getClusterTime()
- Specified by:
getClusterTime
in interfaceClientSession
- Returns:
- the latest cluster time seen by this session
-
getOperationTime
public BsonTimestamp getOperationTime()
Description copied from interface:ClientSession
Gets the operation time of the last operation executed in this session.- Specified by:
getOperationTime
in interfaceClientSession
- Returns:
- the operation time
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSession
in interfaceClientSession
- Returns:
- the server session
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp newOperationTime)
Description copied from interface:ClientSession
Set the operation time of the last operation executed in this session.- Specified by:
advanceOperationTime
in interfaceClientSession
- Parameters:
newOperationTime
- the operation time
-
advanceClusterTime
public void advanceClusterTime(BsonDocument newClusterTime)
- Specified by:
advanceClusterTime
in interfaceClientSession
- Parameters:
newClusterTime
- the cluster time to advance to
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceClientSession
- Specified by:
close
in interfacejava.io.Closeable
-
-