ConnectionContext context = new ConnectionContext();
// While we have records in the journal.
while ((pos = journal.getNextRecordLocation(pos)) != null) {
Packet data = journal.read(pos);
DataStructure c = (DataStructure) wireFormat.unmarshal(toByteSequence(data));
if (c instanceof Message ) {
Message message = (Message) c;
QuickJournalMessageStore store = (QuickJournalMessageStore) createMessageStore(message.getDestination());
if ( message.isInTransaction()) {
transactionStore.addMessage(store, message, pos);
}
else {
store.replayAddMessage(context, message, pos);
transactionCounter++;
}
} else {
switch (c.getDataStructureType()) {
case JournalQueueAck.DATA_STRUCTURE_TYPE:
{
JournalQueueAck command = (JournalQueueAck) c;
QuickJournalMessageStore store = (QuickJournalMessageStore) createMessageStore(command.getDestination());
if (command.getMessageAck().isInTransaction()) {