[Minor] Moved finally block in AbstractTransaction to .close()

This commit is contained in:
Robert von Burg 2022-09-15 11:24:16 +02:00
parent ea983d1113
commit 1e114c1ab2
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 10 additions and 14 deletions

View File

@ -107,6 +107,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
this.txResult.setState(TransactionState.OPEN);
}
@Override
public String getAction() {
return this.action;
}
@ -125,8 +126,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
return this.txResult.getState().isOpen();
}
@Override
public boolean isRollingBack() {
return this.txResult.getState().isRollingBack();
@ -193,11 +192,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
this.closeStrategy = closeStrategy;
}
@Override
public void close() throws StrolchTransactionException {
this.closeStrategy.close(this);
}
@Override
public StrolchTransaction readOnly() {
setCloseStrategy(TransactionCloseStrategy.READ_ONLY);
@ -317,11 +311,13 @@ public abstract class AbstractTransaction implements StrolchTransaction {
add(command);
}
@Override
public void add(Command command) {
assertNotReadOnly();
this.commands.add(command);
}
@Override
public boolean isReadOnly() {
return this.closeStrategy.isReadonly();
}
@ -1572,10 +1568,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
this.txResult.setState(TransactionState.FAILED);
handleFailure(true, start, e);
} finally {
releaseElementLocks();
TransactionThreadLocal.removeTx();
}
}
@ -1592,9 +1584,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
} catch (Exception e) {
handleFailure(true, start, e);
this.txResult.setState(TransactionState.FAILED);
} finally {
releaseElementLocks();
TransactionThreadLocal.removeTx();
}
}
@ -1636,6 +1625,13 @@ public abstract class AbstractTransaction implements StrolchTransaction {
}
handleFailure(true, start, e);
this.txResult.setState(TransactionState.FAILED);
}
}
@Override
public void close() throws StrolchTransactionException {
try {
this.closeStrategy.close(this);
} finally {
releaseElementLocks();
TransactionThreadLocal.removeTx();