class RaftActor extends AbstractUntypedPersistentActor {

    @Deprecated
    @Override
    // FIXME: make this method final once our unit tests do not need to override it
    protected void handleCommand(final Object message) {
        if (serverConfigurationSupport.handleMessage(message, getSender())) {
            return;
        }
        if (snapshotSupport.handleSnapshotMessage(message, getSender())) {
            return;
        }
        if (message instanceof ApplyState) {
            ApplyState applyState = (ApplyState) message;

            if (!hasFollowers()) {
                // for single node, the capture should happen after the apply state
                // as we delete messages from the persistent journal which have made it to the snapshot
                // capturing the snapshot before applying makes the persistent journal and snapshot out of sync
                // and recovery shows data missing
                context.getReplicatedLog().captureSnapshotIfReady(applyState.getReplicatedLogEntry());

                context.getSnapshotManager().trimLog(context.getLastApplied());
            }

            possiblyHandleBehaviorMessage(message);
        } else if (message instanceof ApplyJournalEntries) {
            ApplyJournalEntries applyEntries = (ApplyJournalEntries) message;
            LOG.debug("{}: Persisting ApplyJournalEntries with index={}", persistenceId(), applyEntries.getToIndex());

            persistence().persistAsync(applyEntries, NoopProcedure.instance());

        } else if (message instanceof FindLeader) {
            getSender().tell(
                new FindLeaderReply(getLeaderAddress()),
                getSelf()
            );
        } else if (message instanceof GetOnDemandRaftState) {
            onGetOnDemandRaftStats();
        } else if (message instanceof InitiateCaptureSnapshot) {
            captureSnapshot();
        } else if (message instanceof SwitchBehavior) {
            switchBehavior((SwitchBehavior) message);
        } else if (message instanceof LeaderTransitioning) {
            onLeaderTransitioning((LeaderTransitioning)message);
        } else if (message instanceof Shutdown) {
            onShutDown();
        } else if (message instanceof Runnable) {
            ((Runnable)message).run();
        } else if (message instanceof NoopPayload) {
            persistData(null, null, (NoopPayload) message, false);
        } else if (message instanceof RequestLeadership) {
            onRequestLeadership((RequestLeadership) message);
        } else if (!possiblyHandleBehaviorMessage(message)) {
            handleNonRaftCommand(message);
        }
    }

    protected  RaftActor(final String id, final Map<String, String> peerAddresses,
         final Optional<ConfigParams> configParams, final short payloadVersion);

}