1 10 11 package org.mule.util.xa; 12 13 import javax.transaction.xa.Xid ; 14 15 import java.util.HashMap ; 16 import java.util.Map ; 17 18 22 public abstract class AbstractXAResourceManager extends AbstractResourceManager 23 { 24 25 protected Map suspendedContexts = new HashMap (); 26 protected Map activeContexts = new HashMap (); 27 28 public AbstractXAResourceManager() 29 { 30 super(); 31 } 32 33 protected boolean includeBranchInXid() 34 { 35 return true; 36 } 37 38 AbstractTransactionContext getTransactionalResource(Xid xid) 39 { 40 AbstractTransactionContext context = getActiveTransactionalResource(xid); 41 if (context != null) 42 { 43 return context; 44 } 45 else 46 { 47 return getSuspendedTransactionalResource(xid); 48 } 49 } 50 51 AbstractTransactionContext getActiveTransactionalResource(Xid xid) 52 { 53 return (AbstractTransactionContext)activeContexts.get(xid); 54 } 55 56 AbstractTransactionContext getSuspendedTransactionalResource(Xid xid) 57 { 58 return (AbstractTransactionContext)suspendedContexts.get(xid); 59 } 60 61 void addActiveTransactionalResource(Xid xid, AbstractTransactionContext context) 62 { 63 activeContexts.put(xid, context); 64 } 65 66 void addSuspendedTransactionalResource(Xid xid, AbstractTransactionContext context) 67 { 68 suspendedContexts.put(xid, context); 69 } 70 71 void removeActiveTransactionalResource(Xid xid) 72 { 73 activeContexts.remove(xid); 74 } 75 76 void removeSuspendedTransactionalResource(Xid xid) 77 { 78 suspendedContexts.remove(xid); 79 } 80 81 } 82 | Popular Tags |