1 25 26 package org.objectweb.jonas.resource; 27 28 import javax.resource.ResourceException ; 29 import javax.transaction.Transaction ; 30 import javax.transaction.RollbackException ; 31 import javax.transaction.SystemException ; 32 import org.objectweb.transaction.jta.ResourceManagerEvent; 33 import org.objectweb.util.monolog.api.BasicLevel; 34 import org.objectweb.util.monolog.api.Logger; 35 36 44 class RMEImpl implements ResourceManagerEvent { 45 48 private MCInfo mci = null; 49 52 private Logger trace = null; 53 59 protected boolean isValid = false; 60 61 68 public RMEImpl(MCInfo mci, Logger trace) { 69 this.mci = mci; 70 this.trace = trace; 71 } 72 73 74 79 public boolean equals(Object o) { 80 return (o instanceof RMEImpl) && mci.equals(((RMEImpl) o).mci); 81 } 82 83 84 90 public void enlistConnection(Transaction tx) throws SystemException { 91 try { 92 if (isValid) { 93 if (trace.isLoggable(BasicLevel.DEBUG)) { 94 trace.log(BasicLevel.DEBUG, "Enlist the XA Resource " + mci.getXAResource() 95 + " in Tx:" + tx); 96 } 97 tx.enlistResource(mci.getXAResource()); 98 } 99 } catch (RollbackException rbe) { 100 throw new SystemException (rbe.getMessage()); 101 } catch (ResourceException re) { 102 throw new SystemException (re.getMessage()); 103 } 104 } 105 } 106 | Popular Tags |