Prevented edge case of committing before logging

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
Jim Martens 2017-05-31 15:29:59 +02:00
parent 4cd09e31ee
commit 8ed0e171cc
1 changed files with 2 additions and 2 deletions

View File

@ -53,8 +53,8 @@ public class PersistenceManager {
* @return transaction ID * @return transaction ID
*/ */
synchronized int beginTransaction() { synchronized int beginTransaction() {
_transactions.put(_nextTransactionNumber, false);
log(_nextTransactionNumber, -1, "BOT", ""); log(_nextTransactionNumber, -1, "BOT", "");
_transactions.put(_nextTransactionNumber, false);
// return the next transaction number and increase it by one afterwards // return the next transaction number and increase it by one afterwards
return _nextTransactionNumber++; return _nextTransactionNumber++;
} }
@ -71,8 +71,8 @@ public class PersistenceManager {
} }
// only perform commit actions if transaction isn't commited yet // only perform commit actions if transaction isn't commited yet
if (!_transactions.get(taid)) { if (!_transactions.get(taid)) {
_transactions.replace(taid, true);
log(taid, -1, "COMMIT", ""); log(taid, -1, "COMMIT", "");
_transactions.replace(taid, true);
} }
} }