Skip to content

Commit f4deb2d

Browse files
author
chengyitian
committed
AJ-862: fix issue about single node reconnect nums;
1 parent c791530 commit f4deb2d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,19 +1296,19 @@ public void switchDataNode(Node node) throws IOException{
12961296
isConnected = true;
12971297
break;
12981298
}
1299-
}
1300-
1301-
if (nodes_.isEmpty()){
1302-
log.error("Connect to " + node.hostName + ":" + node.port + " failed.");
1303-
throw new RuntimeException("Connect to " + node.hostName + ":" + node.port + " failed.");
1304-
}
1299+
} else {
1300+
if (nodes_.isEmpty()){
1301+
log.error("Connect to " + node.hostName + ":" + node.port + " failed.");
1302+
throw new RuntimeException("Connect to " + node.hostName + ":" + node.port + " failed.");
1303+
}
13051304

1306-
int index = nodeRandom_.nextInt(nodes_.size());
1307-
if (connectNode(nodes_.get(index))) {
1308-
if (nodes_.size() > 1)
1309-
log.info("Switch to node: " + nodes_.get(index).hostName + ":" + nodes_.get(index).port + " successfully.");
1310-
isConnected = true;
1311-
break;
1305+
int index = nodeRandom_.nextInt(nodes_.size());
1306+
if (connectNode(nodes_.get(index))) {
1307+
if (nodes_.size() > 1)
1308+
log.info("Switch to node: " + nodes_.get(index).hostName + ":" + nodes_.get(index).port + " successfully.");
1309+
isConnected = true;
1310+
break;
1311+
}
13121312
}
13131313

13141314
try {

0 commit comments

Comments
 (0)