Skip to content

Commit

Permalink
modified viewChange() to pass View
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Jul 6, 2007
1 parent a2eb4a0 commit c0201be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/org/jgroups/blocks/ReplicatedHashMap.java
Expand Up @@ -33,7 +33,7 @@
* This class combines both {@link org.jgroups.blocks.ReplicatedHashtable} (asynchronous replication) and
* {@link org.jgroups.blocks.DistributedHashtable} (synchronous replication) into one class
* @author Bela Ban
* @version $Id: ReplicatedHashMap.java,v 1.2 2007/07/04 14:30:58 belaban Exp $
* @version $Id: ReplicatedHashMap.java,v 1.3 2007/07/06 07:44:02 belaban Exp $
*/
public class ReplicatedHashMap<K extends Serializable,V extends Serializable> extends HashMap<K,V> implements ExtendedMessageListener, ExtendedMembershipListener {

Expand All @@ -45,7 +45,7 @@ public interface Notification {

void entryRemoved(Object key);

void viewChange(Vector new_mbrs, Vector old_mbrs);
void viewChange(View view, Vector new_mbrs, Vector old_mbrs);

void contentsSet(Map new_entries);

Expand Down Expand Up @@ -557,10 +557,9 @@ public void viewAccepted(View new_view) {
Vector<Address> new_mbrs=new_view.getMembers();

if(new_mbrs != null) {
sendViewChangeNotifications(new_mbrs, members); // notifies observers (joined, left)
members.removeAllElements();
for(int i=0; i < new_mbrs.size(); i++)
members.addElement(new_mbrs.elementAt(i));
sendViewChangeNotifications(new_view, new_mbrs, new Vector<Address>(members)); // notifies observers (joined, left)
members.clear();
members.addAll(new_mbrs);
}
//if size is bigger than one, there are more peers in the group
//otherwise there is only one server.
Expand All @@ -583,7 +582,7 @@ public void block() {
}


void sendViewChangeNotifications(Vector<Address> new_mbrs, Vector<Address> old_mbrs) {
void sendViewChangeNotifications(View view, Vector<Address> new_mbrs, Vector<Address> old_mbrs) {
Vector<Address> joined, left;
Notification n;

Expand All @@ -608,7 +607,7 @@ void sendViewChangeNotifications(Vector<Address> new_mbrs, Vector<Address> old_m

for(int i=0; i < notifs.size(); i++) {
n=notifs.elementAt(i);
n.viewChange(joined, left);
n.viewChange(view, joined, left);
}
}

Expand Down

0 comments on commit c0201be

Please sign in to comment.