You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So when we miss off a transaction.end() the thread local state holds an inactive transaction. This isn't a problem people will generally notice as inactive transactions are handled when the next transaction occurs.
However, we can do better and cleanup the threadLocal state on both commit() / rollback() as well as end().
Steps to reproduce
Transactiontxn1 = server().beginTransaction();
try {
txn1.commit();
} finally {
// accidentally omit end()//txn1.end();
}
// internal check on thread local status ... application code doesn't do thisSpiTransactiontxn2 = DefaultTransactionThreadLocal.get("h2");
assertThat(txn2).isNull();
So with this change Ebean will perform a cleanup of transaction scope on commit() / rollback() ... and also on end() - and will perform the cleanup once so usually on commit() and rollback().
Internals note that ScopedTransaction handles nesting transactions so we really only do the scope cleanup when we are back at the top (no nested transactions to pop).
The text was updated successfully, but these errors were encountered:
So when we miss off a
transaction.end()
the thread local state holds an inactive transaction. This isn't a problem people will generally notice as inactive transactions are handled when the next transaction occurs.However, we can do better and cleanup the threadLocal state on both commit() / rollback() as well as end().
Steps to reproduce
So with this change Ebean will perform a cleanup of transaction scope on commit() / rollback() ... and also on end() - and will perform the cleanup once so usually on commit() and rollback().
Internals note that ScopedTransaction handles nesting transactions so we really only do the scope cleanup when we are back at the top (no nested transactions to pop).
The text was updated successfully, but these errors were encountered: