Package org.jboss.messaging.core.tx

Examples of org.jboss.messaging.core.tx.MessagingXid


        in.readFully(branchQual);
        int formatId = in.readInt();
        l = in.readInt();
        byte[] globalTxId = new byte[l];
        in.readFully(globalTxId);
        xid = new MessagingXid(branchQual, formatId, globalTxId);
     }
     else
     {
        throw new IllegalStateException("Invalid value:" + isXid);
     }
View Full Code Here


     
      // Recreate Xid. See JBMESSAGING-661 [JPL]

      if (!(xid instanceof MessagingXid))
      {
         xid = new MessagingXid(xid);
      }

      boolean convertTx = false;
     
      Object currentXid = sessionState.getCurrentTxId();
View Full Code Here

      // Recreate Xid. See JBMESSAGING-661 [JPL]

      if (!(xid instanceof MessagingXid))
      {
         xid = new MessagingXid(xid);
      }

      //TODO - why do we need this synchronized block?
      synchronized (this)
      {        
View Full Code Here

      // Recreate Xid. See JBMESSAGING-661 [JPL]

      if (!(xid instanceof MessagingXid))
      {
         xid = new MessagingXid(xid);
      }

      return rm.prepare(xid, connection);
   }
View Full Code Here

      // Recreate Xid. See JBMESSAGING-661 [JPL]

      if (!(xid instanceof MessagingXid))
      {
         xid = new MessagingXid(xid);
      }

      rm.commit(xid, onePhase, connection);
   }
View Full Code Here

      // Recreate Xid. See JBMESSAGING-661 [JPL]

      if (!(xid instanceof MessagingXid))
      {
         xid = new MessagingXid(xid);
      }

      rm.rollback(xid, connection);
   }
View Full Code Here

      try
      {
         for (int outerCount = 0; outerCount < iterations; outerCount++)
         {
            MessagingXid xid = null;
            if (commitSize > 0)
            {
               xid = new MessagingXid("bq1".getBytes(), 1, new GUID().toString().getBytes());
               xaResource.start(xid, XAResource.TMNOFLAGS);
            }
            for (int innerCount = 0; innerCount < commitSize; innerCount++)
            {
               Message m = sess.createMessage();
               m.setStringProperty("PROD_NAME", prodName);
               m.setIntProperty("MSG_NUMBER", outerCount * commitSize + innerCount);  
               prod.send(m);
            }
            if (commitSize > 0)
            {
               xaResource.end(xid, XAResource.TMSUCCESS);
               xaResource.prepare(xid);
               xaResource.commit(xid, false);
            }
            if (rollbackSize > 0)
            {
               xid = new MessagingXid("bq1".getBytes(), 1, new GUID().toString().getBytes());
               xaResource.start(xid, XAResource.TMNOFLAGS);
            }
            for (int innerCount = 0; innerCount < rollbackSize; innerCount++)
            {
               Message m = sess.createMessage();
View Full Code Here

     
      try
      {     
         int iterations = numMessages / commitSize;
        
         MessagingXid xid = null;
        
         xid = new MessagingXid("bq1".getBytes(), 1, new GUID().toString().getBytes());
            xaResource.start(xid, XAResource.TMNOFLAGS);
        
         for (int outerCount = 0; outerCount < iterations; outerCount++)
         {
                                               
            for (int innerCount = 0; innerCount < commitSize; innerCount++)
            {
               Message m = getMessage();
                       
               if (m == null)
               {
                  log.error("Message is null");
                  failed = true;
                  return;
               }
               String prodName = m.getStringProperty("PROD_NAME");
               Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER"));
              
        //       log.info("got " + prodName + ":" + msgCount);
                    
               Count count = (Count)counts.get(prodName);
               if (count == null)
               {
                  //First time
                  if (msgCount.intValue() != 0)
                  {
                     log.error("First message from " + prodName + " is not 0, it is " + msgCount);
                     failed = true;
                     return;
                  }
                  else
                  {
                     count = new Count();
                     counts.put(prodName, count);
                  }
               }
               else
               {
                  if (count.lastCommitted != msgCount.intValue() - 1)
                  {
                     log.error("Message out of sequence for " + prodName + ", expected " + (count.lastCommitted + 1) + ", actual " + msgCount);
                     failed = true;
                     return;
                  }
               }
               count.lastCommitted = msgCount.intValue();
              
               count.lastReceived = msgCount.intValue();
              
               if (innerCount == commitSize -1)
               {
                  xaResource.end(xid, XAResource.TMSUCCESS);
                  xaResource.prepare(xid);
                  xaResource.commit(xid, false);
                                   
                  //Starting new tx
                  xid = new MessagingXid("bq1".getBytes(), 1, new GUID().toString().getBytes());
                  xaResource.start(xid, XAResource.TMNOFLAGS);
                
               }
              
               processingDone();           
            }           
                       
            if (outerCount == iterations - 1)
            {
               break;
            }
                                      
            for (int innerCount = 0; innerCount < rollbackSize; innerCount++)
            {
               Message m = getMessage();
              
               if (m == null)
               {
                  log.error("Message is null (rollback)");
                  failed = true;
                  return;
               }
               String prodName = m.getStringProperty("PROD_NAME");              
               Integer msgCount = new Integer(m.getIntProperty("MSG_NUMBER"));
              
         //      log.info("got " + prodName + ":" + msgCount);
              
               Count count = (Count)counts.get(prodName);
               if (count == null)
               {
                  // First time
                  if (msgCount.intValue() != 0)
                  {
                     log.error("First message from " + prodName + " is not 0, it is " + msgCount);
                     failed = true;
                     return;
                  }
                  else
                  {
                     count = new Count();
                     count.lastCommitted = -1;
                     counts.put(prodName, count);
                  }                
               }
               else
               {
                  if (count.lastReceived != msgCount.intValue() - 1)
                  {
                     log.error("Message out of sequence");
                     failed = true;
                     return;
                  }
               }
               count.lastReceived = msgCount.intValue();         
              
               if (innerCount == rollbackSize -1)
               {
                  xaResource.end(xid, XAResource.TMSUCCESS);
                  xaResource.prepare(xid);
                  xaResource.rollback(xid);
                 
                  xid = new MessagingXid("bq1".getBytes(), 1, new GUID().toString().getBytes());
                  xaResource.start(xid, XAResource.TMNOFLAGS);
               }
               processingDone();
            }           
         }
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

        
         XASession sess2 = conn2.createXASession();
        
         XAResource res = sess2.getXAResource();
        
         Xid xid1 = new MessagingXid("bq1".getBytes(), 42, "eemeli".getBytes());
        
         res.start(xid1, XAResource.TMNOFLAGS);
        
         MessageProducer prod3 = sess2.createProducer(queueA);
        
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.tx.MessagingXid

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.