Files
ebean/src/main/java/io/ebeaninternal/server/transaction/TransactionScopeManager.java
T
Roland Praml 2678f85506 Fix memory leak in threadLocal on implicit transactions (#1711)
* 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.
2019-05-18 10:00:34 +12:00

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);
}