if (deleteAllMessages) {
asyncDataManager.delete();
try {
JournalTrace trace = new JournalTrace();
trace.setMessage("DELETED " + new Date());
Location location = asyncDataManager.write(wireFormat.marshal(trace), false);
asyncDataManager.setMark(location, true);
LOG.info("Journal deleted: ");
deleteAllMessages = false;
} catch (IOException e) {
throw e;
} catch (Throwable e) {
throw IOExceptionSupport.create(e);
}
referenceStoreAdapter.deleteAllMessages();
}
referenceStoreAdapter.start();
Set<Integer> files = referenceStoreAdapter.getReferenceFileIdsInUse();
LOG.info("Active data files: " + files);
checkpointTask = taskRunnerFactory.createTaskRunner(new Task() {
public boolean iterate() {
doCheckpoint();
return false;
}
}, "ActiveMQ Journal Checkpoint Worker");
createTransactionStore();
//
// The following was attempting to reduce startup times by avoiding the
// log
// file scanning that recovery performs. The problem with it is that XA
// transactions
// only live in transaction log and are not stored in the reference
// store, but they still
// need to be recovered when the broker starts up.
if (!referenceStoreAdapter.isStoreValid()) {
LOG.warn("The ReferenceStore is not valid - recovering ...");
recover();
LOG.info("Finished recovering the ReferenceStore");
} else {
Location location = writeTraceMessage("RECOVERED " + new Date(), true);
asyncDataManager.setMark(location, true);
// recover transactions
getTransactionStore().setPreparedTransactions(referenceStoreAdapter.retrievePreparedState());
}