queues[0] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[0] = office1.bindClusteredQueue("sub1", "topic1", queues[0]);  queues[1] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[1] = office1.bindClusteredQueue("sub2", "topic1", queues[1]);  queues[2] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[2] = office2.bindClusteredQueue("sub3", "topic1", queues[2]);  queues[3] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[3] = office2.bindClusteredQueue("sub4", "topic1", queues[3]);  queues[4] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[4] = office2.bindClusteredQueue("sub5", "topic1", queues[4]);  queues[5] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[5] = office1.bindClusteredQueue("sub6", "topic1", queues[5]);  queues[6] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[6] = office1.bindClusteredQueue("sub7", "topic1", queues[6]);  queues[7] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[7] = office1.bindClusteredQueue("sub8", "topic1", queues[7]);  queues[8] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[8] = office1.bindClusteredQueue("sub9", "topic2", queues[8]);  queues[9] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[9] = office1.bindClusteredQueue("sub10", "topic2", queues[9]);  queues[10] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[10] = office2.bindClusteredQueue("sub11", "topic2", queues[10]);  queues[11] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[11] = office2.bindClusteredQueue("sub12", "topic2", queues[11]);  queues[12] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[12] = office2.bindClusteredQueue("sub13", "topic2", queues[12]);  queues[13] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[13] = office1.bindClusteredQueue("sub14", "topic2", queues[13]);  queues[14] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[14] = office1.bindClusteredQueue("sub15", "topic2", queues[14]);  queues[15] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null); bindings[15] = office1.bindClusteredQueue("sub16", "topic2", queues[15]);
queues[0] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[0] = office1.bindClusteredQueue("sub1", "topic1", null, queues[0]);  queues[1] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[1] = office1.bindClusteredQueue("sub2", "topic1", null, queues[1]);  queues[2] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[2] = office2.bindClusteredQueue("sub3", "topic1", null, queues[2]);  queues[3] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[3] = office2.bindClusteredQueue("sub4", "topic1", null, queues[3]);  queues[4] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[4] = office2.bindClusteredQueue("sub5", "topic1", null, queues[4]);  queues[5] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[5] = office1.bindClusteredQueue("sub6", "topic1", null, queues[5]);  queues[6] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[6] = office1.bindClusteredQueue("sub7", "topic1", null, queues[6]);  queues[7] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[7] = office1.bindClusteredQueue("sub8", "topic1", null, queues[7]);  queues[8] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[8] = office1.bindClusteredQueue("sub9", "topic2", null, queues[8]);  queues[9] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[9] = office1.bindClusteredQueue("sub10", "topic2", null, queues[9]);  queues[10] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[10] = office2.bindClusteredQueue("sub11", "topic2", null, queues[10]);  queues[11] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[11] = office2.bindClusteredQueue("sub12", "topic2", null, queues[11]);  queues[12] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[12] = office2.bindClusteredQueue("sub13", "topic2", null, queues[12]);  queues[13] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[13] = office1.bindClusteredQueue("sub14", "topic2", null, queues[13]);  queues[14] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[14] = office1.bindClusteredQueue("sub15", "topic2", null, queues[14]);  queues[15] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get()); bindings[15] = office1.bindClusteredQueue("sub16", "topic2", null, queues[15]);
   protected void clusteredTransactionalRoute(boolean persistent) throws Throwable   {      ClusteredPostOffice office1 = null;            ClusteredPostOffice office2 = null;            try      {            //Start two offices                  office1 = createClusteredPostOffice("node1", "testgroup");         office2 = createClusteredPostOffice("node2", "testgroup");              ClusteredQueue[] queues = new ClusteredQueue[16];         Binding[] bindings = new Binding[16];                  queues[0] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[0] = office1.bindClusteredQueue("sub1", "topic1", queues[0]);                  queues[1] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[1] = office1.bindClusteredQueue("sub2", "topic1", queues[1]);                  queues[2] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[2] = office2.bindClusteredQueue("sub3", "topic1", queues[2]);                  queues[3] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[3] = office2.bindClusteredQueue("sub4", "topic1", queues[3]);                  queues[4] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[4] = office2.bindClusteredQueue("sub5", "topic1", queues[4]);                  queues[5] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[5] = office1.bindClusteredQueue("sub6", "topic1", queues[5]);                  queues[6] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[6] = office1.bindClusteredQueue("sub7", "topic1", queues[6]);                  queues[7] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[7] = office1.bindClusteredQueue("sub8", "topic1", queues[7]);                  queues[8] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[8] = office1.bindClusteredQueue("sub9", "topic2", queues[8]);                  queues[9] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[9] = office1.bindClusteredQueue("sub10", "topic2", queues[9]);                  queues[10] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[10] = office2.bindClusteredQueue("sub11", "topic2", queues[10]);                  queues[11] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[11] = office2.bindClusteredQueue("sub12", "topic2", queues[11]);                  queues[12] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[12] = office2.bindClusteredQueue("sub13", "topic2", queues[12]);                  queues[13] = new ClusteredQueue(im.getId(), ms, pm, true, false, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[13] = office1.bindClusteredQueue("sub14", "topic2", queues[13]);                  queues[14] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[14] = office1.bindClusteredQueue("sub15", "topic2", queues[14]);                  queues[15] = new ClusteredQueue(im.getId(), ms, pm, true, true, 2000, 100, 100, (QueuedExecutor)pool.get(), null);                  bindings[15] = office1.bindClusteredQueue("sub16", "topic2", queues[15]);         SimpleReceiver[] receivers = new SimpleReceiver[16];                  for (int i = 0; i < 16; i++)         {            receivers[i] = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);            queues[i].add(receivers[i]);         }                  //First for topic 1                  Message msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);;               MessageReference ref1 = ms.reference(msg1);                  Message msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);;               MessageReference ref2 = ms.reference(msg2);                  Transaction tx = tr.createTransaction();         boolean routed = office1.route(ref1, "topic1", tx);                  assertTrue(routed);         routed = office1.route(ref2, "topic1", tx);                  assertTrue(routed);                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.commit();                  //Messages are sent asych so may take some finite time to arrive         Thread.sleep(1000);                  for (int i = 0; i < 8; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].acknowledge(msgRec1, null);            receivers[i].acknowledge(msgRec2, null);            msgs = queues[i].browse();            assertNotNull(msgs);                        assertTrue(msgs.isEmpty());                                    receivers[i].clear();         }                  for (int i = 8; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);;               ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);;               ref2 = ms.reference(msg2);                  tx = tr.createTransaction();         routed = office1.route(ref1, "topic1", tx);                  assertTrue(routed);         routed = office1.route(ref2, "topic1", tx);                  assertTrue(routed);                  //Messages are sent asych so may take some finite time to arrive         Thread.sleep(1000);                           for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.rollback();                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  //Now send some non transactionally                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);         ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);         ref2 = ms.reference(msg2);                  routed = office1.route(ref1, "topic1", null);                  assertTrue(routed);         routed = office1.route(ref2, "topic1", null);                  assertTrue(routed);                  //Messages are sent asych so may take some finite time to arrive         Thread.sleep(1000);                           //And acknowledge transactionally                  tx = tr.createTransaction();                  for (int i = 0; i < 8; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                          receivers[i].acknowledge(msgRec1, tx);            receivers[i].acknowledge(msgRec2, tx);                                    msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].clear();         }                  for (int i = 8; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.commit();                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                           // and the rollback                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);;               ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);;               ref2 = ms.reference(msg2);                  routed = office1.route(ref1, "topic1", null);                  assertTrue(routed);         routed = office1.route(ref2, "topic1", null);                  assertTrue(routed);                  Thread.sleep(1000);                          tx = tr.createTransaction();                  for (int i = 0; i < 8; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                          receivers[i].acknowledge(msgRec1, tx);            receivers[i].acknowledge(msgRec2, tx);                                    msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                     }                  for (int i = 8; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.rollback();                  for (int i = 0; i < 8; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                                   msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].acknowledge(msgRec1, null);            receivers[i].acknowledge(msgRec2, null);                                       receivers[i].clear();         }                  for (int i = 8; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                           // Now for topic 2                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);             ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);              ref2 = ms.reference(msg2);                  tx = tr.createTransaction();         routed = office1.route(ref1, "topic2", tx);                  assertTrue(routed);         routed = office1.route(ref2, "topic2", tx);                  assertTrue(routed);                                    for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.commit();                  //Messages are sent asych so may take some finite time to arrive         Thread.sleep(1000);                  for (int i = 0; i < 8; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  for (int i = 8; i < 16; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].acknowledge(msgRec1, null);            receivers[i].acknowledge(msgRec2, null);            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());             receivers[i].clear();         }                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);;               ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);;               ref2 = ms.reference(msg2);                  tx = tr.createTransaction();         routed = office1.route(ref1, "topic1", tx);                  assertTrue(routed);         routed = office1.route(ref2, "topic1", tx);                  assertTrue(routed);                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  tx.rollback();                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  //Now send some non transactionally                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);               ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);               ref2 = ms.reference(msg2);                  routed = office1.route(ref1, "topic2", null);                  assertTrue(routed);         routed = office1.route(ref2, "topic2", null);                  assertTrue(routed);                  Thread.sleep(1000);                  //And acknowledge transactionally                  tx = tr.createTransaction();                  for (int i = 0; i < 8; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  for (int i = 8; i < 16; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                          receivers[i].acknowledge(msgRec1, tx);            receivers[i].acknowledge(msgRec2, tx);                                    msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].clear();         }                                    tx.commit();                  for (int i = 0; i < 16; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                           // and the rollback                  msg1 = CoreMessageFactory.createCoreMessage(1, persistent, null);;               ref1 = ms.reference(msg1);                  msg2 = CoreMessageFactory.createCoreMessage(2, persistent, null);;               ref2 = ms.reference(msg2);                  routed = office1.route(ref1, "topic2", null);                  assertTrue(routed);         routed = office1.route(ref2, "topic2", null);                  assertTrue(routed);                  Thread.sleep(1000);                   tx = tr.createTransaction();                  for (int i = 0; i < 8; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  for (int i = 8; i < 16; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                          receivers[i].acknowledge(msgRec1, tx);            receivers[i].acknowledge(msgRec2, tx);                                    msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());         }                                    tx.rollback();                  for (int i = 0; i < 8; i++)         {            List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());            msgs = queues[i].browse();            assertNotNull(msgs);            assertTrue(msgs.isEmpty());         }                  for (int i = 8; i < 16; i++)         {                     List msgs = receivers[i].getMessages();            assertNotNull(msgs);            assertEquals(2, msgs.size());            Message msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            Message msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                                                                msgs = queues[i].browse();                        assertNotNull(msgs);            assertEquals(2, msgs.size());            msgRec1 = (Message)msgs.get(0);            assertEquals(msg1.getMessageID(), msgRec1.getMessageID());            msgRec2 = (Message)msgs.get(1);            assertEquals(msg2.getMessageID(), msgRec2.getMessageID());                        receivers[i].acknowledge(msgRec1, null);            receivers[i].acknowledge(msgRec2, null);                                     receivers[i].clear();         }      }      finally      {         if (office1 != null)         {            office2.unbindClusteredQueue("sub5");            office1.unbindClusteredQueue("sub7");            office1.unbindClusteredQueue("sub8");            office2.unbindClusteredQueue("sub13");            office1.unbindClusteredQueue("sub15");            office1.unbindClusteredQueue("sub16");            office1.stop();         }                  if (office2 != null)         {            office2.stop();         }      }   }