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:
getPinnedServerAddressin interfaceClientSession- Specified by:
getPinnedServerAddressin interfaceClientSession
-
hasActiveTransaction
public boolean hasActiveTransaction()
- Specified by:
hasActiveTransactionin interfaceClientSession
-
notifyMessageSent
public boolean notifyMessageSent()
- Specified by:
notifyMessageSentin interfaceClientSession
-
notifyOperationInitiated
public void notifyOperationInitiated(Object operation)
- Specified by:
notifyOperationInitiatedin interfaceClientSession
-
getTransactionOptions
public TransactionOptions getTransactionOptions()
- Specified by:
getTransactionOptionsin interfaceClientSession
-
startTransaction
public void startTransaction()
- Specified by:
startTransactionin interfaceClientSession
-
startTransaction
public void startTransaction(TransactionOptions transactionOptions)
- Specified by:
startTransactionin interfaceClientSession
-
commitTransaction
public void commitTransaction()
- Specified by:
commitTransactionin interfaceClientSession
-
abortTransaction
public void abortTransaction()
- Specified by:
abortTransactionin interfaceClientSession
-
withTransaction
public <T> T withTransaction(TransactionBody<T> transactionBody)
- Specified by:
withTransactionin interfaceClientSession
-
getSnapshotTimestamp
public BsonTimestamp getSnapshotTimestamp()
- Specified by:
getSnapshotTimestampin interfaceClientSession
-
withTransaction
public <T> T withTransaction(TransactionBody<T> transactionBody, TransactionOptions options)
- Specified by:
withTransactionin interfaceClientSession
-
getSession
@NonNull public ClientSession getSession()
- Returns:
- the session
-
getTransactionContext
public Object getTransactionContext()
- Specified by:
getTransactionContextin interfaceClientSession
-
setTransactionContext
public void setTransactionContext(ServerAddress serverAddress, Object o)
- Specified by:
setTransactionContextin interfaceClientSession
-
clearTransactionContext
public void clearTransactionContext()
- Specified by:
clearTransactionContextin interfaceClientSession
-
getRecoveryToken
@Nullable public BsonDocument getRecoveryToken()
- Specified by:
getRecoveryTokenin interfaceClientSession
-
setRecoveryToken
public void setRecoveryToken(BsonDocument recoveryToken)
- Specified by:
setRecoveryTokenin interfaceClientSession
-
getOptions
public ClientSessionOptions getOptions()
- Specified by:
getOptionsin interfaceClientSession
-
isCausallyConsistent
public boolean isCausallyConsistent()
- Specified by:
isCausallyConsistentin interfaceClientSession
-
getOriginator
public Object getOriginator()
- Specified by:
getOriginatorin interfaceClientSession
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSessionin interfaceClientSession
-
getOperationTime
public BsonTimestamp getOperationTime()
- Specified by:
getOperationTimein interfaceClientSession
-
advanceOperationTime
public void advanceOperationTime(BsonTimestamp operationTime)
- Specified by:
advanceOperationTimein interfaceClientSession
-
advanceClusterTime
public void advanceClusterTime(BsonDocument clusterTime)
- Specified by:
advanceClusterTimein interfaceClientSession
-
setSnapshotTimestamp
public void setSnapshotTimestamp(BsonTimestamp bsonTimestamp)
- Specified by:
setSnapshotTimestampin interfaceClientSession
-
getClusterTime
public BsonDocument getClusterTime()
- Specified by:
getClusterTimein interfaceClientSession
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClientSession- Specified by:
closein interfaceCloseable
-
-