Package org.jboss.jms.exception

Examples of org.jboss.jms.exception.MessagingXAException


      {
         connection.sendTransaction(request, false);
      }
      catch (JMSSecurityException security)
      {
         MessagingXAException xaEx = new MessagingXAException(XAException.XA_RBROLLBACK, "A security exception happend!", security);
         log.error(xaEx, xaEx);
         throw xaEx;
      }
      catch (Throwable t)
      {
         //Catch anything else
        
         //We assume that any error is recoverable - and the recovery manager should retry again
         //either after the network connection has been repaired (if that was the problem), or
         //the server has been fixed.
        
         //(In some cases it will not be possible to fix so the user will have to manually resolve the tx)
         if (request.getRequestType() == TransactionRequest.TWO_PHASE_PREPARE_REQUEST)
         {
           
            String oldBehaviour = System.getProperty("retain.oldxabehaviour");
            if (oldBehaviour != null)
            {
               //Therefore we throw XA_RETRY
               //Note we DO NOT throw XAER_RMFAIL or XAER_RMERR since both if these will cause the Arjuna
               //tx mgr NOT to retry and the transaction will have to be resolve manually.
               throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);
            }
            else
            {
               //https://jira.jboss.org/jira/browse/JBMESSAGING-1734
               throw new MessagingXAException(XAException.XA_RBCOMMFAIL, "A Throwable was caught in sending the transaction", t);
            }           
         }
         else if (request.getRequestType() == TransactionRequest.ONE_PHASE_COMMIT_REQUEST)
         {
            //for one-phase commit, we may have a rollback exeption
            if (t instanceof XAException)
            {
               throw new MessagingXAException(XAException.XA_RBOTHER, "A Throwable was caught in sending one phase commit", t);
            }
            else
            {
               throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending one phase commit", t);           
            }
         }
         else
         {
            throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);           
         }
      }
   }
View Full Code Here


      {
         connection.sendTransaction(request, false);
      }
      catch (JMSSecurityException security)
      {
         MessagingXAException xaEx = new MessagingXAException(XAException.XA_RBROLLBACK, "A security exception happend!", security);
         log.error(xaEx, xaEx);
         throw xaEx;
      }
      catch (Throwable t)
      {
         //Catch anything else
        
         //We assume that any error is recoverable - and the recovery manager should retry again
         //either after the network connection has been repaired (if that was the problem), or
         //the server has been fixed.
        
         //(In some cases it will not be possible to fix so the user will have to manually resolve the tx)
         if (request.getRequestType() == TransactionRequest.TWO_PHASE_PREPARE_REQUEST)
         {
           
            String oldBehaviour = System.getProperty("retain.oldxabehaviour");
            if (oldBehaviour != null)
            {
               //Therefore we throw XA_RETRY
               //Note we DO NOT throw XAER_RMFAIL or XAER_RMERR since both if these will cause the Arjuna
               //tx mgr NOT to retry and the transaction will have to be resolve manually.
               throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);
            }
            else
            {
               //https://jira.jboss.org/jira/browse/JBMESSAGING-1734
               throw new MessagingXAException(XAException.XA_RBCOMMFAIL, "A Throwable was caught in sending the transaction", t);
            }           
         }
         else
         {
            throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);           
         }
      }
   }
View Full Code Here

      Object currentXid = sessionState.getCurrentTxId();
     
      // Sanity check
      if (currentXid == null)
      {
         throw new MessagingXAException(XAException.XAER_RMFAIL, "Current xid is not set");
      }
     
      if (sessionState.getCurrentTxId() instanceof LocalTx)
      {
         convertTx = true;
        
         if (trace) { log.trace("Converting local tx into global tx branch"); }
      }     

      //TODO why do we need this synchronized block?
      synchronized (this)
      {
         switch (flags)
         {
            case TMNOFLAGS :
               if (convertTx)
               {   
                  // If I commit/rollback the tx, then there is a short period of time between the
                  // AS (or whoever) calling commit on the tx and calling start to enrolling the
                  // session in a new tx. If the session has any listeners then in that period,
                  // messages can be received asychronously but we want them to be received in the
                  // context of a tx, so we convert.
                  // Also for an transacted delivery in a MDB we need to do this as discussed
                  // in fallbackToLocalTx()
                  setCurrentTransactionId(rm.convertTx((LocalTx)sessionState.getCurrentTxId(), xid));
               }
               else
               {                 
                  setCurrentTransactionId(rm.startTx(xid));                
               }
               break;
            case TMJOIN :
               if(convertTx)
               {
                  setCurrentTransactionId(rm.convertOnJoinTx((LocalTx)sessionState.getCurrentTxId(), xid));
               }
               else
               {
                  setCurrentTransactionId(rm.joinTx(xid));
               }
               break;
            case TMRESUME :
               if(convertTx)
               {
                  setCurrentTransactionId(rm.convertOnJoinTx((LocalTx)sessionState.getCurrentTxId(), xid));
               }
               else
               {
                  setCurrentTransactionId(rm.resumeTx(xid));  
               }

               break;
            default:
               throw new MessagingXAException(XAException.XAER_PROTO, "Invalid flags: " + flags);
         }
      }
   }
View Full Code Here

               break;
            case TMSUCCESS :
               rm.endTx(xid, true);
               break;
            default :
               throw new MessagingXAException(XAException.XAER_PROTO, "Invalid flags: " + flags);        
         }     
      }
   }
View Full Code Here

     
      ClientTransaction state = getTxInternal(xid);
     
      if (state != null)
      {
         throw new MessagingXAException(XAException.XAER_DUPID, "Transaction already exists with xid " + xid);
      }
           
      transactions.put(xid, new ClientTransaction());
     
      return xid;
View Full Code Here

       
      ClientTransaction state = getTxInternal(xid);
     
      if (state == null)
      { 
         throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
      }       
     
      state.setState(ClientTransaction.TX_ENDED);
   }
View Full Code Here

     
      ClientTransaction state = getTxInternal(xid);
     
      if (state == null)
      {
         throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
      }
     
      TransactionRequest request =
         new TransactionRequest(TransactionRequest.TWO_PHASE_PREPARE_REQUEST, xid, state);
     
View Full Code Here

      if (onePhase)
      {
         //Invalid xid
         if (tx == null)
         {      
            throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
         }
        
         TransactionRequest request =
            new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, tx);
        
         request.state = tx;   
        
         sendTransactionXA(request, connection);
      }
      else
      {
         if (tx != null)
         {
            if (tx.getState() != ClientTransaction.TX_PREPARED)
            {   
               throw new MessagingXAException(XAException.XAER_PROTO, "commit called for transaction, but it is not prepared");
            }
         }
         else
         {
            //It's possible we don't actually have the prepared tx here locally - this
View Full Code Here

      {
         //For one phase rollback there is nothing to do on the server
        
         if (tx == null)
         {    
            throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
         }
      }
                 
      //we redeliver the messages
      //locally to their original consumers if they are still open or cancel them to the server
View Full Code Here

     
      ClientTransaction state = getTxInternal(xid);
     
      if (state == null)
      {        
         throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
      }
     
      return xid;
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.exception.MessagingXAException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.