@Override public void processJournalEntry(JournalEntry entry) throws IOException { Message innerEntry = JournalProtoUtils.unwrap(entry); // TODO(gene): A better way to process entries besides a huge switch? if (innerEntry instanceof BlockContainerIdGeneratorEntry) { mBlockContainerIdGenerator.setNextContainerId( ((BlockContainerIdGeneratorEntry) innerEntry).getNextContainerId()); } else if (innerEntry instanceof BlockInfoEntry) { BlockInfoEntry blockInfoEntry = (BlockInfoEntry) innerEntry; mBlocks.put( blockInfoEntry.getBlockId(), new MasterBlockInfo(blockInfoEntry.getBlockId(), blockInfoEntry.getLength())); } else { throw new IOException(ExceptionMessage.UNEXPECTED_JOURNAL_ENTRY.getMessage(entry)); } }
@Override public synchronized void processJournalEntry(JournalEntry entry) throws IOException { Message innerEntry = JournalProtoUtils.unwrap(entry); try { if (innerEntry instanceof CreateStoreEntry) { createStoreFromEntry((CreateStoreEntry) innerEntry); } else if (innerEntry instanceof CompletePartitionEntry) { completePartitionFromEntry((CompletePartitionEntry) innerEntry); } else if (innerEntry instanceof CompleteStoreEntry) { completeStoreFromEntry((CompleteStoreEntry) innerEntry); } else { throw new IOException(ExceptionMessage.UNEXPECTED_JOURNAL_ENTRY.getMessage(innerEntry)); } } catch (TachyonException e) { throw new RuntimeException(e); } }