Source:
public LogReplicationState processEvent(LogReplicationEvent event) throws IllegalTransitionException { switch (event.getType()) { case SNAPSHOT_SYNC_REQUEST: cancelSnapshotSync("another snapshot sync request."); setTransitionEventId(event.getEventID()); snapshotSender.reset(); return this; case SNAPSHOT_SYNC_CONTINUE: if (event.getMetadata().getRequestId() == transitionEventId) { log.debug("InSnapshotSync :: Continuation of snapshot sync for {}", transitionEventId, event.getEventID()); return this; } else { log.warn("Unexpected snapshot sync continue event when in snapshot sync state {}.", event.getEventID(), transitionEventId); throw new IllegalTransitionException(event.getType(), getType()); } case SNAPSHOT_TRANSFER_COMPLETE: log.info("Snapshot Sync transfer is complete for {}", event.getEventID()); WaitSnapshotApplyState waitSnapshotApplyState = (WaitSnapshotApplyState)fsm.getStates().get(LogReplicationStateType.WAIT_SNAPSHOT_APPLY); waitSnapshotApplyState.setTransitionEventId(transitionEventId); waitSnapshotApplyState.setBaseSnapshotTimestamp(snapshotSender.getBaseSnapshotTimestamp()); fsm.setBaseSnapshot(event.getMetadata().getLastTransferredBaseSnapshot()); fsm.setAckedTimestamp(event.getMetadata().getLastLogEntrySyncedTimestamp()); return waitSnapshotApplyState; case SYNC_CANCEL: if (transitionEventId == event.getMetadata().getRequestId()) { cancelSnapshotSync("cancellation request."); LogReplicationState inSnapshotSyncState = fsm.getStates().get(LogReplicationStateType.IN_SNAPSHOT_SYNC); inSnapshotSyncState.setTransitionEventId(UUID.randomUUID()); snapshotSender.reset(); return inSnapshotSyncState; } log.warn("Sync Cancel for eventId {}, but running snapshot sync for {}", event.getEventID(), transitionEventId); return this; case REPLICATION_STOP: cancelSnapshotSync("of a request to stop replication."); return fsm.getStates().get(LogReplicationStateType.INITIALIZED); case REPLICATION_SHUTDOWN: cancelSnapshotSync("replication terminated."); return fsm.getStates().get(LogReplicationStateType.STOPPED); default: { log.warn("Unexpected log replication event when in snapshot sync state.", event.getType()); } throw new IllegalTransitionException(event.getType(), getType()); } }

Target:
public LogReplicationState processEvent(LogReplicationEvent event) throws IllegalTransitionException { switch (event.getType()) { case SNAPSHOT_SYNC_REQUEST: cancelSnapshotSync("another snapshot sync request."); setTransitionEventId(event.getEventID()); snapshotSender.reset(); return this; case SNAPSHOT_SYNC_CONTINUE: if (event.getMetadata().getRequestId() == transitionEventId) { log.debug("InSnapshotSync[{}] :: Continuation of snapshot sync for {}", transitionEventId, event.getEventID()); return this; } else { log.warn("Unexpected snapshot sync continue event when in snapshot sync state {}.", event.getEventID(), transitionEventId); throw new IllegalTransitionException(event.getType(), getType()); } case SNAPSHOT_TRANSFER_COMPLETE: log.info("Snapshot Sync transfer is complete for {}", event.getEventID()); WaitSnapshotApplyState waitSnapshotApplyState = (WaitSnapshotApplyState)fsm.getStates().get(LogReplicationStateType.WAIT_SNAPSHOT_APPLY); waitSnapshotApplyState.setTransitionEventId(transitionEventId); waitSnapshotApplyState.setBaseSnapshotTimestamp(snapshotSender.getBaseSnapshotTimestamp()); fsm.setBaseSnapshot(event.getMetadata().getLastTransferredBaseSnapshot()); fsm.setAckedTimestamp(event.getMetadata().getLastLogEntrySyncedTimestamp()); return waitSnapshotApplyState; case SYNC_CANCEL: if (transitionEventId == event.getMetadata().getRequestId()) { cancelSnapshotSync("cancellation request."); LogReplicationState inSnapshotSyncState = fsm.getStates().get(LogReplicationStateType.IN_SNAPSHOT_SYNC); inSnapshotSyncState.setTransitionEventId(UUID.randomUUID()); snapshotSender.reset(); return inSnapshotSyncState; } log.warn("Sync Cancel for eventId {}, but running snapshot sync for {}", event.getEventID(), transitionEventId); return this; case REPLICATION_STOP: cancelSnapshotSync("of a request to stop replication."); return fsm.getStates().get(LogReplicationStateType.INITIALIZED); case REPLICATION_SHUTDOWN: cancelSnapshotSync("replication terminated."); return fsm.getStates().get(LogReplicationStateType.STOPPED); default: { log.warn("Unexpected log replication event when in snapshot sync state.", event.getType()); } throw new IllegalTransitionException(event.getType(), getType()); } }