Skip to content

Commit 26202c6

Browse files
author
chengyitian
committed
AJ-820: fix issue about single node reconnect error;
1 parent df5744f commit 26202c6

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/com/xxdb/DBConnection.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,13 +1303,12 @@ public void switchDataNode(Node node) throws IOException{
13031303
throw new RuntimeException("Connect to " + node.hostName + ":" + node.port + " failed.");
13041304
}
13051305

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

13151314
try {

0 commit comments

Comments
 (0)