diff options
Diffstat (limited to 'java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java')
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java index 5c54c1164f..117beb82ef 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java @@ -37,7 +37,7 @@ public class DtxRegistry private static final class ComparableXid { private final Xid _xid; - + private ComparableXid(Xid xid) { _xid = xid; @@ -58,7 +58,7 @@ public class DtxRegistry ComparableXid that = (ComparableXid) o; return compareBytes(_xid.getBranchId(), that._xid.getBranchId()) - && compareBytes(_xid.getGlobalId(), that._xid.getGlobalId()); + && compareBytes(_xid.getGlobalId(), that._xid.getGlobalId()); } private static boolean compareBytes(byte[] a, byte[] b) @@ -94,7 +94,7 @@ public class DtxRegistry return result; } } - + public synchronized DtxBranch getBranch(Xid xid) { return _branches.get(new ComparableXid(xid)); @@ -116,7 +116,7 @@ public class DtxRegistry return (_branches.remove(new ComparableXid(branch.getXid())) != null); } - public void commit(Xid id, boolean onePhase) + public synchronized void commit(Xid id, boolean onePhase) throws IncorrectDtxStateException, UnknownDtxBranchException, AMQStoreException, RollbackOnlyDtxException, TimeoutDtxException { DtxBranch branch = getBranch(id); @@ -204,7 +204,7 @@ public class DtxRegistry } } - public void rollback(Xid id) + public synchronized void rollback(Xid id) throws IncorrectDtxStateException, UnknownDtxBranchException, AMQStoreException, TimeoutDtxException @@ -318,6 +318,7 @@ public class DtxRegistry branch.disassociateSession(session); } } + } |