public class ClientSessionImpl extends java.lang.Object implements ClientSession
| Modifier and Type | Field and Description |
|---|---|
private boolean |
closed |
private static java.lang.String |
CLUSTER_TIME_KEY |
private BsonDocument |
clusterTime |
private BsonTimestamp |
operationTime |
private ClientSessionOptions |
options |
private java.lang.Object |
originator |
private ServerSession |
serverSession |
private ServerSessionPool |
serverSessionPool |
| Constructor and Description |
|---|
ClientSessionImpl(ServerSessionPool serverSessionPool,
java.lang.Object originator,
ClientSessionOptions options) |
| Modifier and Type | Method and 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() |
private BsonDocument |
greaterOf(BsonDocument newClusterTime) |
private BsonTimestamp |
greaterOf(BsonTimestamp newOperationTime) |
boolean |
isCausallyConsistent()
Returns true if operations in this session must be causally consistent
|
private static final java.lang.String CLUSTER_TIME_KEY
private final ServerSessionPool serverSessionPool
private final ServerSession serverSession
private final java.lang.Object originator
private final ClientSessionOptions options
private BsonDocument clusterTime
private BsonTimestamp operationTime
private volatile boolean closed
public ClientSessionImpl(ServerSessionPool serverSessionPool, java.lang.Object originator, ClientSessionOptions options)
public ClientSessionOptions getOptions()
ClientSessiongetOptions in interface ClientSessionpublic boolean isCausallyConsistent()
ClientSessionisCausallyConsistent in interface ClientSessionpublic java.lang.Object getOriginator()
ClientSessionImportant because sessions must only be used by their own originator.
getOriginator in interface ClientSessionpublic BsonDocument getClusterTime()
getClusterTime in interface ClientSessionpublic BsonTimestamp getOperationTime()
ClientSessiongetOperationTime in interface ClientSessionpublic ServerSession getServerSession()
getServerSession in interface ClientSessionpublic void advanceOperationTime(BsonTimestamp newOperationTime)
ClientSessionadvanceOperationTime in interface ClientSessionnewOperationTime - the operation timepublic void advanceClusterTime(BsonDocument newClusterTime)
advanceClusterTime in interface ClientSessionnewClusterTime - the cluster time to advance toprivate BsonDocument greaterOf(BsonDocument newClusterTime)
private BsonTimestamp greaterOf(BsonTimestamp newOperationTime)
public void close()
close in interface ClientSessionclose in interface java.io.Closeableclose in interface java.lang.AutoCloseable