Skip to content

Commit d157f44

Browse files
author
chengyitian
committed
AJ-837: add 'isNodeInitialized()' check logic when DBConnection connectNode;
1 parent 12e2a6c commit d157f44

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,20 @@ public boolean connectNode(Node node) throws IOException {
13201320
log.info("Connect to " + node.hostName + ":" + node.port + ".");
13211321
while (!closed_){
13221322
try {
1323-
return conn_.connect(node.hostName, node.port, uid_, pwd_, connTimeout_, connectTimeout_, readTimeout_);
1323+
boolean connected = conn_.connect(node.hostName, node.port, uid_, pwd_, connTimeout_, connectTimeout_, readTimeout_);
1324+
if (!connected) {
1325+
return false;
1326+
}
1327+
1328+
boolean nodeInited;
1329+
try {
1330+
nodeInited = ((BasicBoolean) conn_.run("isNodeInitialized", new ArrayList<>(), 0)).getBoolean();
1331+
} catch (Exception e) {
1332+
log.error("Server does not support the initialization check. Please upgrade to a newer version.");
1333+
nodeInited = true;
1334+
}
1335+
1336+
return nodeInited;
13241337
} catch (Exception e) {
13251338
if (isConnected()){
13261339
Node tmpNode = new Node();

0 commit comments

Comments
 (0)