public void rollback(Xid xid) throws XAException { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "XAResourceImpl:rollback(), the Xid is:" + xid + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId()); } xid = createGSXid(xid); try { m_txnManger.abort(xid, COMMIT_ABORT_DEFAULT_TIMEOUT); } catch (UnknownTransactionException e) { if (failOnInvalidRollback) _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , unknownTxnException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBPROTO, e); } catch (CannotAbortException e) { _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , CannotAbortException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBPROTO, e); } catch (RemoteException e) { _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , remoteException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBCOMMFAIL, e); } catch (TimeoutExpiredException e) { _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , timeoutException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XAER_RMFAIL, e); } finally { _activeEmptyTransactions.remove(xid); _suspendedXtns.remove(xid); if (_resourcePerSingleTxn) _relevantTx = false; } }
public void commit(Xid xid, boolean onePhase) throws XAException { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "XAResourceImpl:commit(), the xid is:" + xid + ", the onePhase:" + onePhase + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId()); } xid = createGSXid(xid); try { m_txnManger.commit(xid, COMMIT_ABORT_DEFAULT_TIMEOUT); } catch (UnknownTransactionException e) { _logger.log(Level.SEVERE, "XAResourceImpl:commit() , unknowntxnException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XAER_RMERR, e); } catch (CannotCommitException e) { _logger.log(Level.SEVERE, "XAResourceImpl:commit() , cannotcommitException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XAER_RMERR, e); } catch (RemoteException e) { _logger.log(Level.SEVERE, "XAResourceImpl:commit() , remoteException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XAER_RMFAIL, e); } catch (TimeoutExpiredException e) { _logger.log(Level.SEVERE, "XAResourceImpl:commit() , timeoutexpiredException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XAER_RMFAIL, e); } finally { _activeEmptyTransactions.remove(xid); _suspendedXtns.remove(xid); if (_resourcePerSingleTxn) _relevantTx = false; } }
public int prepare(Xid xid) throws XAException { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "XAResourceImpl:prepare(), the Xid is: " + xid + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId()); } xid = createGSXid(xid); if (_activeEmptyTransactions.remove(xid) != null) { // if empty than read_only return XA_RDONLY; } try { int result = m_txnManger.prepare(xid); switch (result) { // Try to prepare case TransactionParticipant.PREPARED: return XA_OK; case TransactionParticipant.NOTCHANGED: return XA_RDONLY; default: // Abort throw new XAException(XAException.XA_RBROLLBACK); } } catch (UnknownTransactionException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , UnknownTransactionException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBROLLBACK, e); } catch (CannotCommitException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , CannotCommitException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBROLLBACK, e); } catch (RemoteException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , remoteException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBCOMMFAIL, e); } }