{
Xid xid = newXID();
Queue queue = server.createQueue(new SimpleString("A1"), new SimpleString("A1"), null, true, false);
PageSubscriptionCounter counter = locateCounter(queue);
StorageManager storage = server.getStorageManager();
Transaction tx = new TransactionImpl(xid, server.getStorageManager(), 300);
for (int i = 0 ; i < 2000; i++)
{
counter.increment(tx, 1);
}
assertEquals(0, counter.getValue());
tx.prepare();
storage.waitOnOperations();
assertEquals(0, counter.getValue());
server.stop();
server = newHornetQServer();
server.start();
storage = server.getStorageManager();
queue = server.locateQueue(new SimpleString("A1"));
assertNotNull(queue);
counter = locateCounter(queue);
tx = server.getResourceManager().removeTransaction(xid);
assertNotNull(tx);
assertEquals(0, counter.getValue());
tx.commit(false);
storage.waitOnOperations();
assertEquals(2000, counter.getValue());
}