/** * Applies a journal entry commit to the state machine. * * This method is automatically discovered by the Copycat framework. * * @param commit the commit */ public synchronized void applyJournalEntryCommand(Commit<JournalEntryCommand> commit) { JournalEntry entry; try { entry = JournalEntry.parseFrom(commit.command().getSerializedJournalEntry()); } catch (Exception e) { ProcessUtils.fatalError(LOG, e, "Encountered invalid journal entry in commit: {}.", commit); System.exit(-1); throw new IllegalStateException(e); // We should never reach here. } try { applyEntry(entry); } finally { Preconditions.checkState(commit.index() > mLastAppliedCommitIndex); mLastAppliedCommitIndex = commit.index(); commit.close(); } }
/** * Returns the message index. */ public long index() { return commit.index(); }
/** * Returns the task index. */ public long index() { return commit.index(); }
@Override public long index() { return parent.index(); }
@Override public long index() { return parent.index(); }
@Override public long index() { return commit.index(); }
@Override public long index() { return commit.index(); }
public long index(Commit<Index> commit) { try { return commit.index(); } finally { commit.close(); } } }
public long index(Commit<Index> commit) { try { return commit.index(); } finally { commit.close(); } } }
@Override public void delete() { Iterator<Map.Entry<Object, Map<Object, Commit<? extends MultiMapCommands.TtlCommand>>>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Object, Map<Object, Commit<? extends MultiMapCommands.TtlCommand>>> entry = iterator.next(); for (Commit<? extends MultiMapCommands.TtlCommand> value : entry.getValue().values()) { Scheduled timer = timers.remove(value.index()); if (timer != null) timer.cancel(); value.close(); } iterator.remove(); } }
@Override public void delete() { Iterator<Map.Entry<Object, Map<Object, Commit<? extends MultiMapCommands.TtlCommand>>>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Object, Map<Object, Commit<? extends MultiMapCommands.TtlCommand>>> entry = iterator.next(); for (Commit<? extends MultiMapCommands.TtlCommand> value : entry.getValue().values()) { Scheduled timer = timers.remove(value.index()); if (timer != null) timer.cancel(); value.close(); } iterator.remove(); } }
public long put(Commit<Put> commit) { try { Commit<Put> old = map.put(commit.operation().key, commit); if (old != null) { old.close(); } return commit.index(); } catch (Exception e) { commit.close(); throw e; } }
public long remove(Commit<Remove> commit) { try { Commit<Put> removed = map.remove(commit.operation().key); if (removed != null) { removed.close(); } return commit.index(); } finally { commit.close(); } }
public long remove(Commit<Remove> commit) { try { Commit<Put> removed = map.remove(commit.operation().key); if (removed != null) { removed.close(); } return commit.index(); } finally { commit.close(); } }
public long put(Commit<Put> commit) { try { Commit<Put> old = map.put(commit.operation().key, commit); if (old != null) { old.close(); } return commit.index(); } catch (Exception e) { commit.close(); throw e; } }
public long command(Commit<TestCommand> commit) { try { return commit.index(); } finally { if (last != null) last.close(); last = commit; } }
public long query(Commit<TestQuery> commit) { try { return commit.index(); } finally { commit.close(); } }
private Member(Commit<GroupCommands.Join> commit) { this.commit = commit; this.index = commit.index(); this.memberId = commit.operation().member(); this.address = commit.operation().address(); this.persistent = commit.operation().persist(); this.session = commit.session(); }
MemberState(Commit<GroupCommands.Join> commit) { this.commit = commit; this.index = commit.index(); this.memberId = commit.operation().member(); this.persistent = commit.operation().persist(); this.session = commit.session(); this.metadata = commit.operation().metadata(); }