- Improve transaction support
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / transaction / SimpleTransactionManager.java
index 6261a02655fc74ac06079fd2c8ef95f6d65c99e1..edb57268119d9edd7a4e6b1474a4e6274c0bb571 100644 (file)
@@ -38,11 +38,11 @@ public class SimpleTransactionManager implements TransactionManager,
                if (getCurrent() != null)
                        throw new NotSupportedException(
                                        "Nested transactions are not supported");
-               SimpleTransaction transaction = new SimpleTransaction();
+               SimpleTransaction transaction = new SimpleTransaction(this);
                knownTransactions.put(transaction.getXid(), transaction);
                current.set(transaction);
                if (log.isDebugEnabled())
-                       log.debug("Started transaction " + transaction.getXid());
+                       log.debug("STARTED    " + transaction.getXid());
        }
 
        @Override
@@ -75,17 +75,14 @@ public class SimpleTransactionManager implements TransactionManager,
                if (Status.STATUS_COMMITTED == status
                                || Status.STATUS_ROLLEDBACK == status) {
                        current.remove();
-                       knownTransactions.remove(transaction.getXid());
-                       if (log.isDebugEnabled())
-                               log.debug("Completed transaction "
-                                               + transaction.getXid()
-                                               + " ["
-                                               + (status == Status.STATUS_ROLLEDBACK ? "FAILED" : "OK")
-                                               + "]");
                        return null;
                }
                return transaction;
        }
+       
+       void unregister(Xid xid){
+               knownTransactions.remove(xid);
+       }
 
        @Override
        public void resume(Transaction tobj) throws InvalidTransactionException,