Skip to content

Commit

Permalink
[JGRP-1383] Fix race condition in BasicConnectionTable.retainAll by
Browse files Browse the repository at this point in the history
adding appropriate synchronization in BasicTCP.handleDownEvent.
  • Loading branch information
dereed committed Jan 26, 2012
1 parent de2dbe7 commit da732f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/org/jgroups/protocols/BasicTCP.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;


Expand Down Expand Up @@ -262,8 +263,12 @@ protected Object handleDownEvent(Event evt) {
Object ret=super.handleDownEvent(evt); Object ret=super.handleDownEvent(evt);
if(evt.getType() == Event.VIEW_CHANGE) { if(evt.getType() == Event.VIEW_CHANGE) {
suspected_mbrs.clear(); suspected_mbrs.clear();
retainAll(members); // remove all connections from the ConnectionTable which are not members HashSet<Address> copy;
synchronized(members) {
copy=new HashSet<Address>(members);
} }
retainAll(copy);
}
else if(evt.getType() == Event.UNSUSPECT) { else if(evt.getType() == Event.UNSUSPECT) {
Address suspected_mbr=(Address)evt.getArg(); Address suspected_mbr=(Address)evt.getArg();
suspected_mbrs.remove(suspected_mbr); suspected_mbrs.remove(suspected_mbr);
Expand Down

0 comments on commit da732f7

Please sign in to comment.