Search in sources :

Example 1 with GetLeaderRequestProcessor

use of com.alipay.sofa.jraft.rpc.impl.cli.GetLeaderRequestProcessor in project sofa-jraft by sofastack.

the class RaftRpcServerFactory method addRaftRequestProcessors.

/**
 * Adds RAFT and CLI service request processors.
 *
 * @param rpcServer    rpc server instance
 * @param raftExecutor executor to handle RAFT requests.
 * @param cliExecutor  executor to handle CLI service requests.
 */
public static void addRaftRequestProcessors(final RpcServer rpcServer, final Executor raftExecutor, final Executor cliExecutor) {
    // raft core processors
    final AppendEntriesRequestProcessor appendEntriesRequestProcessor = new AppendEntriesRequestProcessor(raftExecutor);
    rpcServer.registerConnectionClosedEventListener(appendEntriesRequestProcessor);
    rpcServer.registerProcessor(appendEntriesRequestProcessor);
    rpcServer.registerProcessor(new GetFileRequestProcessor(raftExecutor));
    rpcServer.registerProcessor(new InstallSnapshotRequestProcessor(raftExecutor));
    rpcServer.registerProcessor(new RequestVoteRequestProcessor(raftExecutor));
    rpcServer.registerProcessor(new PingRequestProcessor());
    rpcServer.registerProcessor(new TimeoutNowRequestProcessor(raftExecutor));
    rpcServer.registerProcessor(new ReadIndexRequestProcessor(raftExecutor));
    // raft cli service
    rpcServer.registerProcessor(new AddPeerRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new RemovePeerRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new ResetPeerRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new ChangePeersRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new GetLeaderRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new SnapshotRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new TransferLeaderRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new GetPeersRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new AddLearnersRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new RemoveLearnersRequestProcessor(cliExecutor));
    rpcServer.registerProcessor(new ResetLearnersRequestProcessor(cliExecutor));
}
Also used : ReadIndexRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.ReadIndexRequestProcessor) RemoveLearnersRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.RemoveLearnersRequestProcessor) TransferLeaderRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.TransferLeaderRequestProcessor) GetPeersRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.GetPeersRequestProcessor) ResetLearnersRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.ResetLearnersRequestProcessor) AppendEntriesRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.AppendEntriesRequestProcessor) RemovePeerRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.RemovePeerRequestProcessor) AddLearnersRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.AddLearnersRequestProcessor) TimeoutNowRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.TimeoutNowRequestProcessor) PingRequestProcessor(com.alipay.sofa.jraft.rpc.impl.PingRequestProcessor) InstallSnapshotRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.InstallSnapshotRequestProcessor) SnapshotRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.SnapshotRequestProcessor) GetFileRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.GetFileRequestProcessor) AddPeerRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.AddPeerRequestProcessor) ChangePeersRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.ChangePeersRequestProcessor) RequestVoteRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.RequestVoteRequestProcessor) GetLeaderRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.GetLeaderRequestProcessor) InstallSnapshotRequestProcessor(com.alipay.sofa.jraft.rpc.impl.core.InstallSnapshotRequestProcessor) ResetPeerRequestProcessor(com.alipay.sofa.jraft.rpc.impl.cli.ResetPeerRequestProcessor)

Aggregations

PingRequestProcessor (com.alipay.sofa.jraft.rpc.impl.PingRequestProcessor)1 AddLearnersRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.AddLearnersRequestProcessor)1 AddPeerRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.AddPeerRequestProcessor)1 ChangePeersRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.ChangePeersRequestProcessor)1 GetLeaderRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.GetLeaderRequestProcessor)1 GetPeersRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.GetPeersRequestProcessor)1 RemoveLearnersRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.RemoveLearnersRequestProcessor)1 RemovePeerRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.RemovePeerRequestProcessor)1 ResetLearnersRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.ResetLearnersRequestProcessor)1 ResetPeerRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.ResetPeerRequestProcessor)1 SnapshotRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.SnapshotRequestProcessor)1 TransferLeaderRequestProcessor (com.alipay.sofa.jraft.rpc.impl.cli.TransferLeaderRequestProcessor)1 AppendEntriesRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.AppendEntriesRequestProcessor)1 GetFileRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.GetFileRequestProcessor)1 InstallSnapshotRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.InstallSnapshotRequestProcessor)1 ReadIndexRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.ReadIndexRequestProcessor)1 RequestVoteRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.RequestVoteRequestProcessor)1 TimeoutNowRequestProcessor (com.alipay.sofa.jraft.rpc.impl.core.TimeoutNowRequestProcessor)1