Package javax.transaction.xa

Examples of javax.transaction.xa.Xid


         byte[] branchQualifier = new byte[] { 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 };

         byte[] globalTxId = new byte[] { 6, 5, 4, 3, 2, 1, 0, 0, 0, 0 };

         Xid trailing = new MessagingXid(branchQualifier, 12435, globalTxId);

         res1.start(trailing, XAResource.TMNOFLAGS);

         MessageProducer prod1 = sess1.createProducer(queue1);

         TextMessage tm1 = sess1.createTextMessage("testing1");

         prod1.send(tm1);

         res1.end(trailing, XAResource.TMSUCCESS);

         res1.prepare(trailing);

         // Now "crash" the server

         ServerManagement.stopServerPeer();

         ServerManagement.startServerPeer();

         deployAndLookupAdministeredObjects();

         conn1.close();

         conn1 = cf.createXAConnection();

         XAResource res = conn1.createXASession().getXAResource();

         Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
         assertEquals(1, xids.length);

         Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
         assertEquals(0, xids2.length);

         Xid trailing2 = xids[0];

         assertTrue(trailing.getFormatId() == trailing2.getFormatId());

         assertEqualByteArrays(trailing.getGlobalTransactionId(), trailing2.getGlobalTransactionId());

         assertEqualByteArrays(trailing.getBranchQualifier(), trailing2.getBranchQualifier());

         res.commit(trailing, false);
      }
      finally
      {
View Full Code Here


            int formatId = rs.getInt(3);

            byte[] globalTxId = getVarBinaryColumn(rs, 4);

            Xid xid = new MessagingXid(branchQual, formatId, globalTxId);

            // create a tx info object with the result set detailsdetails
            txInfo = new PreparedTxInfo(txId, xid, txTimes.get(txId));

            transactions.add(txInfo);
View Full Code Here

         ps.setInt(1, nodeID);

         ps.setLong(2, tx.getId());

         Xid xid = tx.getXid();

         formatID = xid.getFormatId();

         setVarBinaryColumn(3, ps, xid.getBranchQualifier());

         ps.setInt(4, formatID);

         setVarBinaryColumn(5, ps, xid.getGlobalTransactionId());

         rows = ps.executeUpdate();
      }
      finally
      {
View Full Code Here

      Iterator ittx = txs.iterator();
     
      while (ittx.hasNext())
      {
         Transaction tx = (Transaction)ittx.next();
         Xid xid = tx.getXid();
         long tid = tx.getId();
         String stid = String.valueOf(tid);
         String hexGlobalTxid = new String(xid.getGlobalTransactionId());
         String hexBranchQual = new String(xid.getBranchQualifier());
         String hexFormatId = String.valueOf(xid.getFormatId());
        
         Map<String, List<String>> qInfo = new HashMap<String, List<String>>();
        
         List msgList1 = persistenceManager.getMessageChannelPairRefsForTx(tid);
         List msgList2 = persistenceManager.getMessageChannelPairAcksForTx(tid);
View Full Code Here

      Iterator ittx = txs.iterator();
     
      while (ittx.hasNext())
      {
         Transaction tx = (Transaction)ittx.next();
         Xid xid = tx.getXid();
         long tid = tx.getId();
         String stid = String.valueOf(tid);
         String hexGlobalTxid = new String(xid.getGlobalTransactionId());
         String hexBranchQual = new String(xid.getBranchQualifier());
         String hexFormatId = String.valueOf(xid.getFormatId());
        
         Map<String, List<String>> qInfo = new HashMap<String, List<String>>();
        
         List msgList1 = persistenceManager.getMessageChannelPairRefsForTx(tid);
         List msgList2 = persistenceManager.getMessageChannelPairAcksForTx(tid);
View Full Code Here

      JBossStringBuilder buffer = new JBossStringBuilder();
      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
      buffer.append("<tr><th>Xid</th></tr>");
      for (Iterator i = txs.iterator(); i.hasNext();)
      {
         Xid xid = (Xid)i.next();
         if (xid != null)
         {
            buffer.append("<tr><td>");
            buffer.append(xid);
            buffer.append("</td></tr>");
View Full Code Here

      return Arrays.hashCode(gid);
  }

  public boolean equals(Object object) {
      if (object instanceof Xid) {
    Xid xid = (Xid) object;
    return xid.getFormatId() == 1 &&
        Arrays.equals(xid.getGlobalTransactionId(), gid) &&
        xid.getBranchQualifier() == null;
      } else {
    return false;
      }
  }
View Full Code Here

      session.close();
   }

   public void testTxMessageDeliveredCorrectly(final boolean recover) throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
      Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientSessionFactory sessionFactory = locator.createSessionFactory();
      ClientSession session = sessionFactory.createSession(true, false, false);
      session.createQueue(atestq, atestq, null, true);
      session.start(xid, XAResource.TMNOFLAGS);
View Full Code Here

      session.close();
     
     
      for (int i = 0 ; i < NUMBER_OF_MESSAGES; i++)
      {
         Xid xid = newXID();

         session = sessionFactory.createSession(true, false, false);
        
         ClientConsumer consumer = session.createConsumer(atestq);
        
View Full Code Here

      session.start();

      for (int i = 0; i < 100; i++)
      {
         Xid xid = newXID();
         session.start(xid, XAResource.TMNOFLAGS);
         ClientMessage msg = consumer.receive(5000);
         assertNotNull(msg);
         msg.acknowledge();
         session.end(xid, XAResource.TMSUCCESS);
View Full Code Here

TOP

Related Classes of javax.transaction.xa.Xid

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.