public class RaftGroupService extends Object
| 构造器和说明 |
|---|
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions) |
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions,
RpcServer rpcServer) |
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions,
RpcServer rpcServer,
boolean sharedRpcServer) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getGroupId()
Returns the raft group id.
|
RpcOptions |
getNodeOptions()
Returns the node options.
|
Node |
getRaftNode() |
RpcServer |
getRpcServer()
Returns the rpc server instance.
|
PeerId |
getServerId()
Returns the node serverId
|
boolean |
isStarted()
Returns true when service is started.
|
void |
join()
Block thread to wait the server shutdown.
|
void |
setGroupId(String groupId)
Set the raft group id
|
void |
setNodeOptions(NodeOptions nodeOptions)
Set node options.
|
void |
setRpcServer(RpcServer rpcServer)
Set rpc server.
|
void |
setServerId(PeerId serverId)
Set the node serverId
|
void |
shutdown() |
Node |
start()
Starts the raft group service, returns the raft node.
|
Node |
start(boolean startRpcServer)
Starts the raft group service, returns the raft node.
|
public RaftGroupService(String groupId, PeerId serverId, NodeOptions nodeOptions)
public RaftGroupService(String groupId, PeerId serverId, NodeOptions nodeOptions, RpcServer rpcServer)
public RaftGroupService(String groupId, PeerId serverId, NodeOptions nodeOptions, RpcServer rpcServer, boolean sharedRpcServer)
public Node getRaftNode()
public Node start()
public Node start(boolean startRpcServer)
startRpcServer - whether to start RPC server.public void join()
throws InterruptedException
InterruptedException - if the current thread is interrupted
while waitingpublic void shutdown()
public boolean isStarted()
public String getGroupId()
public void setGroupId(String groupId)
public PeerId getServerId()
public void setServerId(PeerId serverId)
public RpcOptions getNodeOptions()
public void setNodeOptions(NodeOptions nodeOptions)
public RpcServer getRpcServer()
public void setRpcServer(RpcServer rpcServer)
Copyright © 2021. All rights reserved.