Skip to content

Commit 58150c1

Browse files
author
chengyitian
committed
AJ-837: add 'isNodeInitialized()' check logic when DBConnection connectNode;
1 parent b77e107 commit 58150c1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,19 @@ public boolean connectNode(Node node) throws IOException {
10591059
log.info("Connect to " + node.hostName + ":" + node.port + ".");
10601060
while (!closed_){
10611061
try {
1062-
return conn_.connect(node.hostName, node.port, uid_, pwd_, connTimeout_, connectTimeout_, readTimeout_);
1062+
boolean connected = conn_.connect(node.hostName, node.port, uid_, pwd_, connTimeout_, connectTimeout_, readTimeout_);
1063+
if (!connected)
1064+
return false;
1065+
1066+
boolean nodeInited;
1067+
try {
1068+
nodeInited = ((BasicBoolean) conn_.run("isNodeInitialized", new ArrayList<>(), 0)).getBoolean();
1069+
} catch (Exception e) {
1070+
log.error("Server does not support the initialization check. Please upgrade to a newer version.");
1071+
nodeInited = true;
1072+
}
1073+
1074+
return nodeInited;
10631075
} catch (Exception e) {
10641076
if (isConnected()){
10651077
Node tmpNode = new Node();

0 commit comments

Comments
 (0)