if (trace) { log.trace("two phase commit rollback request received"); }  tx = tr.getPreparedTx(request.getXid());  if (trace) { log.trace("rolling back " + tx); }
log.error("Exception occured", t); if (tx != null) { try { tx.rollback(); } catch (Exception e) { log.error("Failed to rollback tx", e); } } throw new MessagingTransactionRolledBackException("Transaction was rolled back.", t); } } else if (request.getRequestType() == TransactionRequest.TWO_PHASE_ROLLBACK_REQUEST) { if (trace) { log.trace("Two phase commit rollback request received"); } Transaction tx = null; try { tx = tr.getPreparedTx(request.getXid()); if (trace) { log.trace("Rolling back " + tx); }
   public void sendTransaction(TransactionRequest request) throws JMSException   {      try      {         closeLock.readLock().acquire();      }      catch (InterruptedException e)      {         //Ignore      }      try      {         if (closed)         {            throw new IllegalStateException("Connection is closed");         }                  Transaction tx = null;                  try         {                            if (request.getRequestType() == TransactionRequest.ONE_PHASE_COMMIT_REQUEST)            {               if (trace) { log.trace("one phase commit request received"); }                              tx = tr.createTransaction();               processCommit(request.getState(), tx);               tx.commit();                     }            else if (request.getRequestType() == TransactionRequest.ONE_PHASE_ROLLBACK_REQUEST)            {               if (trace) { log.trace("one phase rollback request received"); }                              //We just need to cancel deliveries               cancelDeliveriesForTransaction(request.getState());            }            else if (request.getRequestType() == TransactionRequest.TWO_PHASE_PREPARE_REQUEST)            {                                       if (trace) { log.trace("two phase commit prepare request received"); }               tx = tr.createTransaction(request.getXid());               processCommit(request.getState(), tx);                    tx.prepare();            }            else if (request.getRequestType() == TransactionRequest.TWO_PHASE_COMMIT_REQUEST)            {                  if (trace) { log.trace("two phase commit commit request received"); }               tx = tr.getPreparedTx(request.getXid());                  if (trace) { log.trace("committing " + tx); }               tx.commit();            }            else if (request.getRequestType() == TransactionRequest.TWO_PHASE_ROLLBACK_REQUEST)            {               if (trace) { log.trace("two phase commit rollback request received"); }               tx = tr.getPreparedTx(request.getXid());                                 if (trace) { log.trace("rolling back " + tx); }               tx.rollback();            }               }         catch (Throwable t)         {            handleFailure(t, tx);         }                  if (trace) { log.trace("request processed ok"); }      }      finally      {         closeLock.readLock().release();      }   }