mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1169 - Memory leak - DefaultTransactionThreadLocal holding reference to transaction
This commit is contained in:
@@ -153,7 +153,7 @@ public class ScopeTrans implements Thread.UncaughtExceptionHandler {
|
||||
}
|
||||
|
||||
protected void restoreSuspended() {
|
||||
if (suspendedTransaction != null) {
|
||||
if (created || suspendedTransaction != null) {
|
||||
// put the previously suspended transaction
|
||||
// back onto the ThreadLocal or equivalent
|
||||
scopeMgr.replace(suspendedTransaction);
|
||||
|
||||
@@ -779,6 +779,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
newTransaction = false;
|
||||
suspended = t;
|
||||
t = null;
|
||||
transactionScopeManager.replace(null);
|
||||
|
||||
} else {
|
||||
// create a new Transaction based on TxType and t
|
||||
@@ -795,13 +796,11 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
isoLevel = isolation.getLevel();
|
||||
}
|
||||
t = transactionManager.createTransaction(true, isoLevel);
|
||||
// note ScopeTrans.onFinally() restores the suspended transaction
|
||||
transactionScopeManager.replace(t);
|
||||
}
|
||||
}
|
||||
|
||||
// replace the current transaction ... ScopeTrans.onFinally()
|
||||
// has the job of restoring the suspended transaction
|
||||
transactionScopeManager.replace(t);
|
||||
|
||||
return new ScopeTrans(rollbackOnChecked, newTransaction, t, txScope, suspended, transactionScopeManager);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user