public Location store(JournalCommand<?> data, boolean sync, Runnable before,Runnable after, Runnable onJournalStoreComplete) throws IOException {
if (before != null) {
before.run();
}
try {
ByteSequence sequence = toByteSequence(data);
long start = System.currentTimeMillis();
Location location = onJournalStoreComplete == null ? journal.write(sequence, sync) : journal.write(sequence, onJournalStoreComplete) ;
long start2 = System.currentTimeMillis();
process(data, location, after);
long end = System.currentTimeMillis();