Permalink
Browse files

Merge branch 'Branch_JGroups_2_6' of github.com:belaban/JGroups into …

…Branch_JGroups_2_6
  • Loading branch information...
2 parents b117b78 + 415c84f commit a9f97e10bff4263af79db1aab828925155698ba4 @belaban committed Oct 2, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/org/jgroups/protocols/VERIFY_SUSPECT.java
View
7 src/org/jgroups/protocols/VERIFY_SUSPECT.java
@@ -12,6 +12,8 @@
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
/**
@@ -25,7 +27,7 @@
private Address local_addr=null;
private long timeout=2000; // number of millisecs to wait for an are-you-dead msg
private int num_msgs=1; // number of are-you-alive msgs and i-am-not-dead responses (for redundancy)
- final Hashtable<Address,Long> suspects=new Hashtable<Address,Long>(); // keys=Addresses, vals=time in mcses since added
+ final ConcurrentMap<Address,Long> suspects=new ConcurrentHashMap<Address,Long>(); // keys=Addresses, vals=time in mcses since added
private Thread timer=null;
private boolean use_icmp=false; // use InetAddress.isReachable() to double-check (rather than an are-you-alive msg)
private InetAddress bind_addr; // interface for ICMP pings
@@ -190,8 +192,7 @@ public void run() {
List<Address> confirmed_suspects=new LinkedList<Address>();
synchronized(suspects) {
- for(Enumeration<Address> e=suspects.keys(); e.hasMoreElements();) {
- Address mbr=e.nextElement();
+ for(Address mbr : suspects.keySet()) {
val=suspects.get(mbr).longValue();
diff=System.currentTimeMillis() - val;
if(diff >= timeout) { // haven't been unsuspected, pass up SUSPECT

0 comments on commit a9f97e1

Please sign in to comment.