File tree 1 file changed +4
-3
lines changed
client/src/main/java/com/vesoft/nebula/client/graph/net
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 5
5
import com .vesoft .nebula .client .graph .exception .ClientServerIncompatibleException ;
6
6
import com .vesoft .nebula .client .graph .exception .IOErrorException ;
7
7
import java .util .ArrayList ;
8
- import java .util .HashMap ;
9
8
import java .util .List ;
10
9
import java .util .Map ;
10
+ import java .util .concurrent .ConcurrentHashMap ;
11
11
import java .util .concurrent .Executors ;
12
12
import java .util .concurrent .ScheduledExecutorService ;
13
13
import java .util .concurrent .TimeUnit ;
@@ -20,7 +20,7 @@ public class RoundRobinLoadBalancer implements LoadBalancer {
20
20
private static final int S_OK = 0 ;
21
21
private static final int S_BAD = 1 ;
22
22
private final List <HostAddress > addresses = new ArrayList <>();
23
- private final Map <HostAddress , Integer > serversStatus = new HashMap <>();
23
+ private final Map <HostAddress , Integer > serversStatus = new ConcurrentHashMap <>();
24
24
private final int timeout ;
25
25
private final AtomicInteger pos = new AtomicInteger (0 );
26
26
private final int delayTime = 60 ; // unit seconds
@@ -80,8 +80,9 @@ public boolean ping(HostAddress addr) {
80
80
} else {
81
81
connection .open (addr , this .timeout );
82
82
}
83
+ boolean pong = connection .ping ();
83
84
connection .close ();
84
- return true ;
85
+ return pong ;
85
86
} catch (IOErrorException | ClientServerIncompatibleException e ) {
86
87
return false ;
87
88
}
You can’t perform that action at this time.
0 commit comments