Package dev.morphia.transactions
Class MorphiaSessionImpl
- java.lang.Object
-
- dev.morphia.DatastoreImpl
-
- dev.morphia.transactions.MorphiaSessionImpl
-
- All Implemented Interfaces:
ClientSession
,ClientSession
,AdvancedDatastore
,Datastore
,MorphiaSession
,Closeable
,AutoCloseable
@MorphiaInternal public class MorphiaSessionImpl extends DatastoreImpl implements MorphiaSession
- Since:
- 2.0
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class dev.morphia.DatastoreImpl
DatastoreImpl.DatastoreOperations
-
-
Constructor Summary
Constructors Constructor Description MorphiaSessionImpl(DatastoreImpl datastore, ClientSession session)
Creates a new session.
-
Method Summary
-
Methods inherited from class dev.morphia.DatastoreImpl
aggregate, aggregate, configureCollection, createAggregation, createAggregation, createQuery, createUpdateOperations, delete, delete, doTransaction, enableDocumentValidation, enableValidation, ensureCaps, ensureIndexes, ensureIndexes, find, find, find, find, getCodecRegistry, getCollection, getDatabase, getLoggedQuery, getMapper, getMongoClient, insert, insert, merge, merge, operations, operations, queryByExample, queryByExample, refresh, replace, replace, save, save, shardCollection, shardCollections, startSession, startSession, withTransaction, withTransaction
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.morphia.AdvancedDatastore
createAggregation, createQuery, createRef, createRef, createUpdateOperations, insert, insert, queryByExample
-
Methods inherited from interface dev.morphia.Datastore
aggregate, aggregate, createAggregation, createQuery, createUpdateOperations, delete, delete, delete, delete, enableDocumentValidation, ensureCaps, ensureIndexes, find, find, find, find, findAndDelete, findAndDelete, findAndModify, findAndModify, getCodecRegistry, getCollection, getDatabase, getLoggedQuery, getMapper, insert, insert, insert, insert, merge, merge, merge, queryByExample, refresh, replace, replace, replace, replace, save, save, save, save, save, save, save, shardCollections, startSession, startSession, update, update, withTransaction, withTransaction
-
-
-
-
Constructor Detail
-
MorphiaSessionImpl
public MorphiaSessionImpl(DatastoreImpl datastore, ClientSession session)
Creates a new session.- Parameters:
datastore
- the datastoresession
- the client session
-
-
Method Detail
-
getPinnedServerAddress
@Nullable public ServerAddress getPinnedServerAddress()
- Specified by:
getPinnedServerAddress
in interfaceClientSession
- Specified by:
getPinnedServerAddress
in interfaceClientSession
-
hasActiveTransaction
public boolean hasActiveTransaction()
- Specified by:
hasActiveTransaction
in interfaceClientSession
-
notifyMessageSent
public boolean notifyMessageSent()
- Specified by:
notifyMessageSent
in interfaceClientSession
-
notifyOperationInitiated
public void notifyOperationInitiated(Object operation)
- Specified by:
notifyOperationInitiated
in interfaceClientSession
-
getTransactionOptions
public TransactionOptions getTransactionOptions()
- Specified by:
getTransactionOptions
in interfaceClientSession
-
startTransaction
public void startTransaction()
- Specified by:
startTransaction
in interfaceClientSession
-
startTransaction
public void startTransaction(TransactionOptions transactionOptions)
- Specified by:
startTransaction
in interfaceClientSession
-
commitTransaction
public void commitTransaction()
- Specified by:
commitTransaction
in interfaceClientSession
-
abortTransaction
public void abortTransaction()
- Specified by:
abortTransaction
in interfaceClientSession
-
withTransaction
public <T> T withTransaction(TransactionBody<T> transactionBody)
- Specified by:
withTransaction
in interfaceClientSession
-
getSnapshotTimestamp
public BsonTimestamp getSnapshotTimestamp()
- Specified by:
getSnapshotTimestamp
in interfaceClientSession
-
withTransaction
public <T> T withTransaction(TransactionBody<T> transactionBody, TransactionOptions options)
- Specified by:
withTransaction
in interfaceClientSession
-
getSession
@NonNull public ClientSession getSession()
- Returns:
- the session
-
getTransactionContext
public Object getTransactionContext()
- Specified by:
getTransactionContext
in interfaceClientSession
-
setTransactionContext
public void setTransactionContext(ServerAddress serverAddress, Object o)
- Specified by:
setTransactionContext
in interfaceClientSession
-
clearTransactionContext
public void clearTransactionContext()
- Specified by:
clearTransactionContext
in interfaceClientSession
-
getRecoveryToken
@Nullable public BsonDocument getRecoveryToken()
- Specified by:
getRecoveryToken
in interfaceClientSession
-
setRecoveryToken
public void setRecoveryToken(BsonDocument recoveryToken)
- Specified by:
setRecoveryToken
in interfaceClientSession
-
getOptions
public ClientSessionOptions getOptions()
- Specified by:
getOptions
in interfaceClientSession
-
isCausallyConsistent
public boolean isCausallyConsistent()
- Specified by:
isCausallyConsistent
in interfaceClientSession
-
getOriginator
public Object getOriginator()
- Specified by:
getOriginator
in interfaceClientSession
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSession
in interfaceClientSession
-
getOperationTime
public BsonTimestamp getOperationTime()
- Specified by:
getOperationTime
in interfaceClientSession
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp operationTime)
- Specified by:
advanceOperationTime
in interfaceClientSession
-
advanceClusterTime
public void advanceClusterTime(BsonDocument clusterTime)
- Specified by:
advanceClusterTime
in interfaceClientSession
-
setSnapshotTimestamp
public void setSnapshotTimestamp(BsonTimestamp bsonTimestamp)
- Specified by:
setSnapshotTimestamp
in interfaceClientSession
-
getClusterTime
public BsonDocument getClusterTime()
- Specified by:
getClusterTime
in interfaceClientSession
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceClientSession
- Specified by:
close
in interfaceCloseable
-
-