java.lang.Object
io.ebeaninternal.server.transaction.TransactionManager
- All Implemented Interfaces:
SpiTransactionManager
Manages transactions.
Keeps the Cache and Cluster in sync when transactions are committed.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate the TransactionManager -
Method Summary
Modifier and TypeMethodDescriptionfinal SpiTransactionactive()Return the current active transaction.final ScopedTransactionbeginScopedTransaction(TxScope txScope) Begin a scoped transaction.final SpiTransactionBegin an implicit transaction.final voidClear an implicit transaction from thread local scope.createReadOnlyTransaction(Object tenantId, boolean useMaster) Create a new Transaction for query only purposes (can use read only datasource).createTransaction(boolean explicit, int isolationLevel) Create a new Transaction.final DataSourceReturn the main DataSource.final BeanDescriptorManagerfinal voidexitScopedTransaction(Object returnOrThrowable, int opCode) Exit a scoped transaction (that can be inactive - already committed etc).final ScopedTransactionexternalBeginTransaction(SpiTransaction transaction, TxScope txScope) Push an externally created transaction into scope.final voidexternalModification(TransactionEventTable tableEvent) final voidCalled when an externally managed transaction has completed.final voidflushTransparent(SpiPersistenceContext persistenceContext, SpiTransaction transaction) Experimental - find dirty beans in the persistence context and persist them.final SpiTransactioninScope()Return the current transaction from thread local scope.final SpiLogManagerlog()logger()final Stringname()final voidnotifyOfCommit(SpiTransaction transaction) Process a local committed transaction.final voidnotifyOfQueryOnly(SpiTransaction transaction) Query only transaction in read committed isolation.final voidnotifyOfRollback(SpiTransaction transaction, Throwable cause) Process a local rolled back transaction.final ConnectionReturn a connection used for query plan collection.final DataSourceReturn the read only DataSource (if defined).final voidremoteTransactionEvent(RemoteTransactionEvent remoteEvent) Notify local BeanPersistListeners etc of events from another server in the cluster.final TransactionScopeManagerscope()Return the scope manager.final voidset(SpiTransaction txn) Set the transaction onto the scope.final voidshutdown(boolean shutdownDataSource, boolean deregisterDriver) final jakarta.persistence.PersistenceExceptiontranslate(String message, SQLException cause) Translate the SQLException into a specific exception if possible based on the DB platform.final voidvisitMetrics(MetricVisitor visitor) Wrap the externally supplied Connection.
-
Constructor Details
-
TransactionManager
Create the TransactionManager
-
-
Method Details
-
scope
Return the scope manager.- Specified by:
scopein interfaceSpiTransactionManager
-
set
Set the transaction onto the scope. -
active
Return the current active transaction.- Specified by:
activein interfaceSpiTransactionManager
-
inScope
Return the current transaction from thread local scope. Note that it may be inactive. -
translate
Translate the SQLException into a specific exception if possible based on the DB platform. -
shutdown
public final void shutdown(boolean shutdownDataSource, boolean deregisterDriver) -
descriptorManager
-
name
-
queryPlanConnection
Description copied from interface:SpiTransactionManagerReturn a connection used for query plan collection.- Specified by:
queryPlanConnectionin interfaceSpiTransactionManager- Throws:
SQLException
-
dataSource
Description copied from interface:SpiTransactionManagerReturn the main DataSource.- Specified by:
dataSourcein interfaceSpiTransactionManager
-
readOnlyDataSource
Description copied from interface:SpiTransactionManagerReturn the read only DataSource (if defined).- Specified by:
readOnlyDataSourcein interfaceSpiTransactionManager
-
wrapExternalConnection
Wrap the externally supplied Connection. -
createTransaction
Create a new Transaction. -
createReadOnlyTransaction
Create a new Transaction for query only purposes (can use read only datasource). -
notifyOfRollback
Process a local rolled back transaction.- Specified by:
notifyOfRollbackin interfaceSpiTransactionManager
-
notifyOfQueryOnly
Query only transaction in read committed isolation.- Specified by:
notifyOfQueryOnlyin interfaceSpiTransactionManager
-
notifyOfCommit
Process a local committed transaction.- Specified by:
notifyOfCommitin interfaceSpiTransactionManager
-
externalModification
-
remoteTransactionEvent
Notify local BeanPersistListeners etc of events from another server in the cluster. -
visitMetrics
-
clearServerTransaction
public final void clearServerTransaction()Clear an implicit transaction from thread local scope. -
beginServerTransaction
Begin an implicit transaction. -
exitScopedTransaction
Exit a scoped transaction (that can be inactive - already committed etc). -
externalRemoveTransaction
public final void externalRemoveTransaction()Description copied from interface:SpiTransactionManagerCalled when an externally managed transaction has completed.- Specified by:
externalRemoveTransactionin interfaceSpiTransactionManager
-
externalBeginTransaction
public final ScopedTransaction externalBeginTransaction(SpiTransaction transaction, TxScope txScope) Push an externally created transaction into scope. This transaction is usually managed externally (e.g. Spring managed transaction).- Specified by:
externalBeginTransactionin interfaceSpiTransactionManager
-
beginScopedTransaction
Begin a scoped transaction. -
logger
-
loggerReadOnly
-
log
-
flushTransparent
public final void flushTransparent(SpiPersistenceContext persistenceContext, SpiTransaction transaction) Experimental - find dirty beans in the persistence context and persist them.
-