TextMessage m2 = (TextMessage)cons.receive(3000);
TextMessage m2 = (TextMessage)cons.receive(1000);
   public void test2PCSendCommit() throws Exception   {      if (ServerManagement.isRemote()) return;            XAConnection conn = null;      Connection conn2 = null;            try      {               conn = cf.createXAConnection();                  tm.begin();                  XASession sess = conn.createXASession();         XAResource res = sess.getXAResource();                  //We also create and enroll another xa resource so the tx mgr uses          //2pc protocol         XAResource res2 = new DummyXAResource();                  Transaction tx = tm.getTransaction();         tx.enlistResource(res);         tx.enlistResource(res2);                  MessageProducer prod = sess.createProducer(queue);         prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);         Message m = sess.createTextMessage("XATest");         prod.send(queue, m);                  tx.commit();                  conn2 = cf.createConnection();         conn2.start();         Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);         MessageConsumer cons = sessReceiver.createConsumer(queue);         TextMessage m2 = (TextMessage)cons.receive(3000);         assertNotNull(m2);         assertEquals("XATest", m2.getText());      }      finally      {         if (conn != null)         {            conn.close();         }         if (conn2 != null)         {            conn2.close();         }      }   }