log.info("********* SENDING MOREMSGS");
   public void testTransactionalAcknowlegment() throws Exception   {      Connection conn = cf.createConnection();      Session producerSess = conn.createSession(true, Session.SESSION_TRANSACTED);      MessageProducer producer = producerSess.createProducer(queue);      Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);      MessageConsumer consumer = consumerSess.createConsumer(queue);      conn.start();      final int NUM_MESSAGES = 20;      //Send some messages      log.info("********* SENDING MSGS");      for (int i = 0; i < NUM_MESSAGES; i++)      {         Message m = producerSess.createMessage();         producer.send(m);      }      log.info("*********** SENT MSGSSGS");            assertRemainingMessages(0);            producerSess.rollback();            //Send some messages      log.info("********* SENDING MOREMSGS");      for (int i = 0; i < NUM_MESSAGES; i++)      {         Message m = producerSess.createMessage();         producer.send(m);      }      log.info("********* SENT MORE MSGS");      assertRemainingMessages(0);            log.info("COMMITTING");      producerSess.commit();      log.info("COMMITTED");            assertRemainingMessages(NUM_MESSAGES);      log.trace("Sent messages");      int count = 0;      while (true)      {         Message m = consumer.receive(200);         if (m == null) break;         count++;      }            assertRemainingMessages(NUM_MESSAGES);      log.trace("Received " + count +  " messages");      assertEquals(count, NUM_MESSAGES);      consumerSess.rollback();            assertRemainingMessages(NUM_MESSAGES);      log.trace("Session rollback called");      Message m = null;      int i = 0;      for(; i < NUM_MESSAGES; i++)      {         m = consumer.receive();         log.trace("Received message " + i);      }            assertRemainingMessages(NUM_MESSAGES);      // if I don't receive enough messages, the test will timeout      log.trace("Received " + i +  " messages after recover");            consumerSess.commit();            assertRemainingMessages(0);      // make sure I don't receive anything else      m = consumer.receive(200);      assertNull(m);      conn.close();   }