Skip to content

Commit

Permalink
modify java client witness
Browse files Browse the repository at this point in the history
  • Loading branch information
lipanpan03 authored and tugraph committed Apr 9, 2024
1 parent 50db181 commit 059fda2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rpc-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<goal>run</goal>
</goals>
<configuration>
<protocVersion>3.6.0</protocVersion>
<protocVersion>3.11.4</protocVersion>
<addSources>none</addSources>
<includeStdTypes>true</includeStdTypes>
<outputDirectory>src/main/java</outputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,12 @@ private void refreshClientPool() {
ClusterInfo clusterInfo = JSON.parseObject(JSON.parseArray(result).get(0).toString(), new TypeReference<ClusterInfo>(){});
List<RaftState> raftStates = clusterInfo.getClusterInfo();
raftStates.forEach(x -> {
TuGraphSingleRpcClient rpcClient = new TuGraphSingleRpcClient("list://" + x.getRpcAddress(), user, password);
rpcClientPool.add(rpcClient);
if (x.getState().equals(RaftState.StateConstant.MASTER)) {
leaderClient = rpcClient;
if (!Objects.equals(x.getRole(), "WITNESS")) {
TuGraphSingleRpcClient rpcClient = new TuGraphSingleRpcClient("list://" + x.getRpcAddress(), user, password);
rpcClientPool.add(rpcClient);
if (x.getState().equals(RaftState.StateConstant.MASTER)) {
leaderClient = rpcClient;
}
}
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class RaftState {
private String rpcAddress;
@JSONField(name = "state")
private String state;
@JSONField(name = "ha_role")
private String role;

public static class StateConstant {

Expand Down

0 comments on commit 059fda2

Please sign in to comment.