File tree 2 files changed +7
-8
lines changed
java/jetbrains/exodus/env
kotlin/jetbrains/exodus/env
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -175,16 +175,15 @@ private void setCurrentTransaction(@NotNull final TransactionBase result) {
175
175
176
176
@ Override
177
177
protected void finishTransaction (@ NotNull final TransactionBase txn ) {
178
- finishTransactionSafe (txn , true );
178
+ final Thread thread = txn .getCreatingThread ();
179
+ if (!Thread .currentThread ().equals (thread )) {
180
+ throw new ExodusException ("Can't finish transaction in a thread different from the one which it was created in" );
181
+ }
182
+ finishTransactionUnsafe (txn );
179
183
}
180
184
181
- void finishTransactionSafe (@ NotNull final TransactionBase txn , boolean checkThread ) {
185
+ void finishTransactionUnsafe (@ NotNull final TransactionBase txn ) {
182
186
final Thread thread = txn .getCreatingThread ();
183
- if (checkThread ) {
184
- if (!Thread .currentThread ().equals (thread )) {
185
- throw new ExodusException ("Can't finish transaction in a thread different from the one which it was created in" );
186
- }
187
- }
188
187
final Deque <TransactionBase > stack = threadTxns .get (thread );
189
188
if (stack == null ) {
190
189
throw new ExodusException ("Transaction was already finished" );
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ internal class StuckTransactionMonitor(env: EnvironmentImpl) : Job() {
57
57
}
58
58
env.transactionExpirationTimeout().forEachExpiredTransaction { txn ->
59
59
if (env is ContextualEnvironmentImpl ) {
60
- env.finishTransactionSafe (txn, false )
60
+ env.finishTransactionUnsafe (txn)
61
61
} else {
62
62
env.finishTransaction(txn)
63
63
}
You can’t perform that action at this time.
0 commit comments