[Major] Now throwing exception if TX is not committed but has commands

This commit is contained in:
Robert von Burg 2017-05-16 14:28:32 +02:00
parent 428b589d47
commit f1216f8825
1 changed files with 2 additions and 4 deletions

View File

@ -723,12 +723,10 @@ public abstract class AbstractTransaction implements StrolchTransaction {
try {
this.txResult.setState(TransactionState.CLOSING);
// TODO re-think this.
if (!this.commands.isEmpty()) {
logger.error(
"There are commands registered on a read-only transaction. Changing to rollback! Probably due to an exception!");
autoCloseableRollback();
return;
String msg = "There are commands registered on a read-only transaction. Changing to rollback! Probably due to an exception!";
throw new IllegalStateException(msg);
}
long auditTrailDuration = writeAuditTrail();