Index: src/org/jgroups/blocks/ReplicatedHashMap.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/blocks/ReplicatedHashMap.java,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 ReplicatedHashMap.java
--- src/org/jgroups/blocks/ReplicatedHashMap.java	28 Feb 2008 07:31:56 -0000	1.12.2.1
+++ src/org/jgroups/blocks/ReplicatedHashMap.java	6 May 2008 16:42:41 -0000
@@ -721,7 +721,7 @@
 
     /*------------------- Membership Changes ----------------------*/
 
-    public void viewAccepted(View new_view) {
+    public void viewAccepted(final View new_view) {
         Vector<Address> new_mbrs=new_view.getMembers();
 
         if(new_mbrs != null) {
@@ -732,6 +732,37 @@
         //if size is bigger than one, there are more peers in the group
         //otherwise there is only one server.
         send_message=members.size() > 1;
+        
+        /**
+		 * In the event of a MergeView abuse the cumulative nature of the
+		 * superclass' setState() method. By ensuring that all members of the
+		 * new merged view add the state of all the coordinators of the previous
+		 * unmerged views, everyone should end up in the same state.
+		 * 
+		 * TODO: What if the getStates() complete in different orders? Is that
+		 * possible?
+		 */
+		if (new_view instanceof MergeView) {
+			final Runnable runnable = new Runnable() {
+
+				@Override
+				public void run() {
+					for (final View subgroup : ((MergeView) new_view)
+							.getSubgroups()) {
+						try {
+							channel.getState(subgroup.getMembers().firstElement(), 0);
+						} catch (final ChannelNotConnectedException e) {
+							throw new IllegalStateException(
+									"channel not connected!", e);
+						} catch (final ChannelClosedException e) {
+							throw new IllegalStateException(
+									"channel is closed!", e);
+						}
+					}
+				}
+			};
+			new Thread(runnable, "map-merging").start();
+		}
     }
 
 
