mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
* refactor TestExecutionComplete
* Add more tests to discover missing threadScope cleanups
* FIX: clear threadScope on implicit created Jdbc transactions
* FIX: clear threadScope on completed JTA transactions
* Revert "FIX: clear threadScope on completed JTA transactions"
This reverts commit f844405542.
56 lines
1.5 KiB
Java
56 lines
1.5 KiB
Java
package io.ebeaninternal.server.transaction;
|
|
|
|
import io.ebeaninternal.api.SpiTransaction;
|
|
import io.ebeaninternal.api.SpiTransactionScopeManager;
|
|
|
|
/**
|
|
* Manages the Transactions typically held in a ThreadLocal.
|
|
*/
|
|
public abstract class TransactionScopeManager implements SpiTransactionScopeManager {
|
|
|
|
protected final String serverName;
|
|
|
|
public TransactionScopeManager(String serverName) {
|
|
this.serverName = serverName;
|
|
}
|
|
|
|
/**
|
|
* Register the transaction manager (for use by external transaction scopes).
|
|
*/
|
|
public abstract void register(TransactionManager manager);
|
|
|
|
/**
|
|
* Return the current Transaction from internal Ebean scope.
|
|
*/
|
|
public abstract SpiTransaction getInScope();
|
|
|
|
/**
|
|
* Return the current Transaction potentially looking in external scope (like Spring).
|
|
*/
|
|
public abstract SpiTransaction getActive();
|
|
|
|
/**
|
|
* Set a new Transaction for this serverName and Thread.
|
|
*/
|
|
public abstract void set(SpiTransaction trans);
|
|
|
|
/**
|
|
* Clears the given Transaction for this serverName and Thread.
|
|
*/
|
|
public abstract void clear(SpiTransaction trans);
|
|
|
|
/**
|
|
* Replace the current transaction with this one.
|
|
* <p>
|
|
* Used for Background fetching and Nested transaction scopes.
|
|
* </p>
|
|
* <p>
|
|
* Used for background fetching. Replaces the current transaction with a
|
|
* 'dummy' transaction. The current transaction is given to the background
|
|
* thread so it can continue the fetch.
|
|
* </p>
|
|
*/
|
|
@Override
|
|
public abstract void replace(SpiTransaction trans);
|
|
}
|