public void testMissingTXEverythingAcked() throws Exception
{
clearData();
Configuration config = createDefaultConfig();
config.setJournalSyncNonTransactional(false);
HornetQServer server = createServer(true,
config,
PagingTest.PAGE_SIZE,
PagingTest.PAGE_MAX,
new HashMap<String, AddressSettings>());
server.start();
final int messageSize = 1024;
final int numberOfMessages = 5000;
final int numberOfTX = 10;
final int messagesPerTX = numberOfMessages / numberOfTX;
try
{
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, false, false);
session.createQueue(ADDRESS.toString(), "q1", true);
session.createQueue(ADDRESS.toString(), "q2", true);
ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
ClientMessage message = null;
byte[] body = new byte[messageSize];
ByteBuffer bb = ByteBuffer.wrap(body);
for (int j = 1; j <= messageSize; j++)
{
bb.put(getSamplebyte(j));
}
for (int i = 0; i < numberOfMessages; i++)
{
message = session.createMessage(true);
HornetQBuffer bodyLocal = message.getBodyBuffer();
bodyLocal.writeBytes(body);
message.putIntProperty(new SimpleString("id"), i);
producer.send(message);
if (i % messagesPerTX == 0)
{
session.commit();
}
}
session.commit();
session.close();
}
finally
{
try
{
server.stop();
}
catch (Throwable ignored)
{
}
}
ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();
List<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>();
JournalImpl jrn = new JournalImpl(config.getJournalFileSize(),
2,
0,
0,
new NIOSequentialFileFactory(getJournalDir()),
"hornetq-data",