-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] pd make the RaftEngine constructor private #2655
Comments
The Here is the relevant code: public class RaftEngine {
private static final RaftEngine INSTANCE = new RaftEngine();
private final RaftStateMachine stateMachine;
private PDConfig.Raft config;
private RaftGroupService raftGroupService;
private RpcServer rpcServer;
private Node raftNode;
private RaftRpcClient raftRpcClient;
RaftEngine() {
this.stateMachine = new RaftStateMachine();
}
public static RaftEngine getInstance() {
return INSTANCE;
}
// Other methods...
} The constructor |
@dosu |
You are correct. To adhere to the singleton pattern, the Here is the modified code with the public class RaftEngine {
private static final RaftEngine INSTANCE = new RaftEngine();
private final RaftStateMachine stateMachine;
private PDConfig.Raft config;
private RaftGroupService raftGroupService;
private RpcServer rpcServer;
private Node raftNode;
private RaftRpcClient raftRpcClient;
private RaftEngine() {
this.stateMachine = new RaftStateMachine();
}
public static RaftEngine getInstance() {
return INSTANCE;
}
// Rest of the class implementation
} This change ensures that the |
Bug Type (问题类型)
logic (逻辑设计问题)
Before submit
Environment (环境信息)
Server Version: 1.5
Expected & Actual behavior (期望与实际表现)
The RaftEngine is intended to be a global singleton, but the constructor is not private.
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response
The text was updated successfully, but these errors were encountered: