for (int i = 0; i < 10; i++)
Message[] messages = createMessages();  Message m1 = messages[0]; Message m2 = messages[1]; Message m3 = messages[2]; Message m4 = messages[3]; Message m5 = messages[4]; Message m6 = messages[5]; Message m7 = messages[6]; Message m8 = messages[7]; Message m9 = messages[8]; Message m10 = messages[9];  Transaction tx = null; if (xa)
   protected void doTransactionRollback(boolean xa, boolean idIsGuid, boolean storeXid) throws Exception   {      if (ServerManagement.isRemote()) return;            JDBCPersistenceManager pm = new JDBCPersistenceManager();      if (idIsGuid)      {         this.configTablesForGUID(pm);      }      pm.setTxIdGuid(idIsGuid);      pm.setStoringXid(storeXid);      MessageStore ms = new PersistentMessageStore("persistentMessageStore0", pm);      Channel channel = new SimpleChannel("channel0", ms);            TransactionRepository txRep = new TransactionRepository(pm);      pm.start();            for (int i = 0; i < 10; i++)      {                  Message[] messages = createMessages();                       Message m1 = messages[0];         Message m2 = messages[1];         Message m3 = messages[2];               Message m4 = messages[3];         Message m5 = messages[4];         Message m6 = messages[5];         Message m7 = messages[6];               Message m8 = messages[7];         Message m9 = messages[8];         Message m10 = messages[9];                  Transaction tx = null;         if (xa)         {            tx = txRep.createTransaction(new MockXid());         }         else         {            tx = txRep.createTransaction();         }                  MessageReference ref1 = ms.reference(m1);         MessageReference ref2 = ms.reference(m2);           MessageReference ref3 = ms.reference(m3);                MessageReference ref4 = ms.reference(m4);         MessageReference ref5 = ms.reference(m5);           MessageReference ref6 = ms.reference(m6);         MessageReference ref7 = ms.reference(m7);                MessageReference ref8 = ms.reference(m8);         MessageReference ref9 = ms.reference(m9);           MessageReference ref10 = ms.reference(m10);                  Delivery del6 = new SimpleDelivery(channel, ref6);         Delivery del7 = new SimpleDelivery(channel, ref7);         Delivery del8 = new SimpleDelivery(channel, ref8);         Delivery del9 = new SimpleDelivery(channel, ref9);         Delivery del10 = new SimpleDelivery(channel, ref10);                        //Add first two refs non transactionally         pm.addReference(channel.getChannelID(), ref1, null);         pm.addReference(channel.getChannelID(), ref2, null);                  //check they're there         List refs = pm.messageRefs(ms.getStoreID(), channel.getChannelID());         assertNotNull(refs);         assertEquals(2, refs.size());         assertTrue(refs.contains(ref1.getMessageID()));         assertTrue(refs.contains(ref2.getMessageID()));                        //Add the next 3 refs transactionally         pm.addReference(channel.getChannelID(), ref3, tx);         pm.addReference(channel.getChannelID(), ref4, tx);         pm.addReference(channel.getChannelID(), ref5, tx);                       //Check they're not visible         refs = pm.messageRefs(ms.getStoreID(), channel.getChannelID());         assertNotNull(refs);         assertEquals(2, refs.size());         assertTrue(refs.contains(ref1.getMessageID()));         assertTrue(refs.contains(ref2.getMessageID()));                    //Add deliveries non transactionally         pm.addDelivery(channel.getChannelID(), del6);         pm.addDelivery(channel.getChannelID(), del7);         pm.addDelivery(channel.getChannelID(), del8);         pm.addDelivery(channel.getChannelID(), del9);         pm.addDelivery(channel.getChannelID(), del10);                  //Check they're there         List dels = pm.deliveries(ms.getStoreID(), channel.getChannelID());         assertNotNull(dels);         assertEquals(5, dels.size());         assertTrue(dels.contains(ref6.getMessageID()));         assertTrue(dels.contains(ref7.getMessageID()));          assertTrue(dels.contains(ref8.getMessageID()));         assertTrue(dels.contains(ref9.getMessageID()));         assertTrue(dels.contains(ref10.getMessageID()));                  //Remove first three transactionally         pm.removeDelivery(channel.getChannelID(), del6, tx);         pm.removeDelivery(channel.getChannelID(), del7, tx);         pm.removeDelivery(channel.getChannelID(), del8, tx);            //Check changes are not visible         dels = pm.deliveries(ms.getStoreID(), channel.getChannelID());         assertNotNull(dels);         assertEquals(5, dels.size());         assertTrue(dels.contains(ref6.getMessageID()));         assertTrue(dels.contains(ref7.getMessageID()));          assertTrue(dels.contains(ref8.getMessageID()));         assertTrue(dels.contains(ref9.getMessageID()));         assertTrue(dels.contains(ref10.getMessageID()));                  //rollback transaction         pm.rollbackTx(tx);                  //check we can see only two         refs = pm.messageRefs(ms.getStoreID(), channel.getChannelID());         assertNotNull(refs);         assertEquals(2, refs.size());         assertTrue(refs.contains(ref1.getMessageID()));         assertTrue(refs.contains(ref2.getMessageID()));                  //Check we can see all 5 deliveries         dels = pm.deliveries(ms.getStoreID(), channel.getChannelID());         assertNotNull(dels);         assertEquals(5, dels.size());         assertTrue(dels.contains(ref6.getMessageID()));         assertTrue(dels.contains(ref7.getMessageID()));          assertTrue(dels.contains(ref8.getMessageID()));         assertTrue(dels.contains(ref9.getMessageID()));         assertTrue(dels.contains(ref10.getMessageID()));                  pm.removeAllMessageData(channel.getChannelID());      }         }