summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
1e1f78c)
This checks with snapshot snapshot support first, making the code a bit
more readable.
Change-Id: I1a9ea097d71b2f28771e19b2b1979ebff0f15e7a
Signed-off-by: Robert Varga <rovarga@cisco.com>
@Override
protected void handleCommand(final Object message) {
@Override
protected void handleCommand(final Object message) {
- if(serverConfigurationSupport.handleMessage(message, getSender())) {
+ if (serverConfigurationSupport.handleMessage(message, getSender())) {
- } else if (message instanceof ApplyState){
+ }
+ if (snapshotSupport.handleSnapshotMessage(message, getSender())) {
+ return;
+ }
+
+ if (message instanceof ApplyState) {
ApplyState applyState = (ApplyState) message;
long elapsedTime = (System.nanoTime() - applyState.getStartTime());
ApplyState applyState = (ApplyState) message;
long elapsedTime = (System.nanoTime() - applyState.getStartTime());
context.getSnapshotManager().trimLog(context.getLastApplied(), currentBehavior);
}
context.getSnapshotManager().trimLog(context.getLastApplied(), currentBehavior);
}
- } else if (message instanceof ApplyJournalEntries){
+ } else if (message instanceof ApplyJournalEntries) {
ApplyJournalEntries applyEntries = (ApplyJournalEntries) message;
if(LOG.isDebugEnabled()) {
LOG.debug("{}: Persisting ApplyLogEntries with index={}", persistenceId(), applyEntries.getToIndex());
ApplyJournalEntries applyEntries = (ApplyJournalEntries) message;
if(LOG.isDebugEnabled()) {
LOG.debug("{}: Persisting ApplyLogEntries with index={}", persistenceId(), applyEntries.getToIndex());
onGetOnDemandRaftStats();
} else if(message instanceof InitiateCaptureSnapshot) {
captureSnapshot();
onGetOnDemandRaftStats();
} else if(message instanceof InitiateCaptureSnapshot) {
captureSnapshot();
- } else if(message instanceof SwitchBehavior){
+ } else if(message instanceof SwitchBehavior) {
switchBehavior(((SwitchBehavior) message));
} else if(message instanceof LeaderTransitioning) {
onLeaderTransitioning();
switchBehavior(((SwitchBehavior) message));
} else if(message instanceof LeaderTransitioning) {
onLeaderTransitioning();
onShutDown();
} else if(message instanceof Runnable) {
((Runnable)message).run();
onShutDown();
} else if(message instanceof Runnable) {
((Runnable)message).run();
- } else if(!snapshotSupport.handleSnapshotMessage(message, getSender())) {
switchBehavior(reusableSwitchBehaviorSupplier.handleMessage(getSender(), message));
}
}
switchBehavior(reusableSwitchBehaviorSupplier.handleMessage(getSender(), message));
}
}