geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject incubator-geode git commit: refactor locator creation to use interfaces. Introduced NetMember interface for this purpose. Added an initial unit test for the membership manager. Changed logger initialization to ignore the log4j2.xml configuration file
Date Wed, 29 Jul 2015 23:53:28 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-77 2af40c665 -> 04cc2d9b5


refactor locator creation to use interfaces.  Introduced NetMember interface for this purpose.  Added an initial unit test for the membership manager.  Changed logger initialization to ignore the log4j2.xml configuration file in the jgroups jar.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/04cc2d9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/04cc2d9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/04cc2d9b

Branch: refs/heads/feature/GEODE-77
Commit: 04cc2d9b58334467c5efb0824727a12f48bf7d1c
Parents: 2af40c6
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Wed Jul 29 16:50:57 2015 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Wed Jul 29 16:50:57 2015 -0700

----------------------------------------------------------------------
 .../cache/util/BoundedLinkedHashMap.java        |   5 -
 .../gemstone/gemfire/distributed/Locator.java   |   5 +-
 .../gemfire/distributed/internal/DM.java        |   2 -
 .../internal/DistributionManager.java           |   4 -
 .../internal/InternalDistributedSystem.java     |   7 +-
 .../distributed/internal/InternalLocator.java   |  16 +-
 .../internal/direct/DirectChannel.java          |  17 ++
 .../internal/membership/MemberFactory.java      |  16 ++
 .../internal/membership/MemberServices.java     |  11 +
 .../internal/membership/MembershipManager.java  |   6 -
 .../membership/gms/GMSMemberFactory.java        |  17 +-
 .../membership/gms/GMSMemberServices.java       | 260 +++++++++++++++++++
 .../internal/membership/gms/GMSUtil.java        |   2 +-
 .../internal/membership/gms/NetLocator.java     |  15 ++
 .../internal/membership/gms/Services.java       | 252 ------------------
 .../membership/gms/auth/GMSAuthenticator.java   |   4 +-
 .../membership/gms/fd/GMSHealthMonitor.java     |   6 +-
 .../membership/gms/interfaces/Service.java      |   4 +-
 .../membership/gms/locator/GMSLocator.java      |  26 +-
 .../membership/gms/membership/GMSJoinLeave.java |  88 ++++---
 .../gms/messenger/AddressManager.java           |   4 +-
 .../gms/messenger/JGroupsMessenger.java         |  39 +--
 .../gms/mgr/GMSMembershipManager.java           |  82 ++----
 .../gemfire/internal/logging/LogService.java    |   3 +-
 .../gemfire/internal/tcp/TCPConduit.java        |   1 +
 .../membership/MembershipJUnitTest.java         | 158 ++++++++++-
 .../membership/gms/MembershipManagerHelper.java |   4 +-
 27 files changed, 624 insertions(+), 430 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BoundedLinkedHashMap.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BoundedLinkedHashMap.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BoundedLinkedHashMap.java
index d95c28e..5397381 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BoundedLinkedHashMap.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BoundedLinkedHashMap.java
@@ -16,12 +16,7 @@ import java.util.Map;
  * number of entries the <code>BoundedLinkedHashMap</code>
  * can contain.
  *
- * @author Barry Oglesby
- *
  * @since 4.2
- * @deprecated as of 5.7 create your own class that extends {@link LinkedHashMap}
- * and implement {@link LinkedHashMap#removeEldestEntry}
- * to enforce a maximum number of entries.
  */
 @Deprecated
 public class BoundedLinkedHashMap extends LinkedHashMap

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/Locator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/Locator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/Locator.java
index 91b6cb6..c0244ed 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/Locator.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/Locator.java
@@ -10,8 +10,9 @@ package com.gemstone.gemfire.distributed;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
-import java.util.*;
-import java.util.concurrent.ConcurrentMap;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
 
 import com.gemstone.gemfire.distributed.internal.InternalLocator;
 import com.gemstone.gemfire.internal.SocketCreator;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DM.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DM.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DM.java
index 4adea7c..ca43db2 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DM.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DM.java
@@ -34,8 +34,6 @@ import com.gemstone.gemfire.internal.Version;
  */
 public interface DM extends ReplySender {
   
-  public void restartCommunications();
-  
   public boolean shutdownInProgress();
   
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
index a9111b5..c65078d 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionManager.java
@@ -1606,10 +1606,6 @@ public class DistributionManager
     } // synchronized
   }
   
-  public void restartCommunications() {
-    membershipManager.reset();
-  }
-
   // DM method
   @Override
   public void forceUDPMessagingForCurrentThread() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
index 20db1fc..58e8884 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
@@ -55,7 +55,7 @@ import com.gemstone.gemfire.distributed.internal.locks.GrantorRequestProcessor;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.QuorumChecker;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
 import com.gemstone.gemfire.i18n.LogWriterI18n;
 import com.gemstone.gemfire.internal.Assert;
@@ -561,7 +561,7 @@ public final class InternalDistributedSystem
       this.securityLogWriter.fine("SecurityLogWriter is created.");
     }
     
-    Services.setSecurityLogWriter(this.securityLogWriter);
+    GMSMemberServices.setSecurityLogWriter(this.securityLogWriter);
 
     this.clock = new DSClock(this.isLoner);
     
@@ -655,9 +655,6 @@ public final class InternalDistributedSystem
             .toLocalizedString(), e);
     }
 
-    if (!this.isLoner) {
-      this.dm.restartCommunications();
-    }
     synchronized (this.isConnectedMutex) {
       this.isConnected = true;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
index 51203d2..5525378 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
@@ -44,8 +44,9 @@ import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.LockServiceDestroyedException;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.ConnectListener;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.DisconnectListener;
+import com.gemstone.gemfire.distributed.internal.membership.MemberFactory;
 import com.gemstone.gemfire.distributed.internal.membership.QuorumChecker;
-import com.gemstone.gemfire.distributed.internal.membership.gms.locator.GMSLocator;
+import com.gemstone.gemfire.distributed.internal.membership.gms.NetLocator;
 import com.gemstone.gemfire.distributed.internal.membership.gms.locator.PeerLocatorRequest;
 import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
 import com.gemstone.gemfire.distributed.internal.tcpserver.TcpHandler;
@@ -163,7 +164,7 @@ public class InternalLocator extends Locator implements ConnectListener {
   private Properties env;
   
   /** the TcpHandler used for peer location */
-  private GMSLocator locatorImpl;
+  private NetLocator locatorImpl;
   
   private DistributionConfigImpl config;
   
@@ -659,12 +660,7 @@ public class InternalLocator extends Locator implements ConnectListener {
       logger.info(LocalizedMessage.create(LocalizedStrings.InternalLocator_FORCING_GROUP_COORDINATION_INTO_LOCATORS));
     }
     
-    // LOG: moved these into InternalDistributedSystem.initialize -- the only other code path constructs InternalLocator 1st which also sets these
-    //com.gemstone.org.jgroups.util.GemFireTracer.setLogWriter(this.logWriter);
-    //com.gemstone.org.jgroups.util.GemFireTracer
-    //    .setSecurityLogWriter(this.securityLogWriter);
-    
-    this.locatorImpl = new GMSLocator(port, this.bindAddress, this.stateFile,
+    this.locatorImpl = MemberFactory.newLocatorHandler(this.bindAddress, this.stateFile,
         locatorsProp, locatorsAreCoordinators, networkPartitionDetectionEnabled);
     this.handler.addHandler(PeerLocatorRequest.class, this.locatorImpl);
     peerLocator = true;
@@ -674,9 +670,9 @@ public class InternalLocator extends Locator implements ConnectListener {
   }
 
   /**
-   * @return the gossipServer
+   * @return the TcpHandler for peer to peer discovery
    */
-  public GMSLocator getLocatorHandler() {
+  public NetLocator getLocatorHandler() {
     return this.locatorImpl;
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java
index c9dc316..acfb060 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/direct/DirectChannel.java
@@ -23,6 +23,7 @@ import java.util.concurrent.Semaphore;
 
 import org.apache.logging.log4j.Logger;
 
+import com.gemstone.gemfire.CancelCriterion;
 import com.gemstone.gemfire.CancelException;
 import com.gemstone.gemfire.InternalGemFireException;
 import com.gemstone.gemfire.SystemFailure;
@@ -105,6 +106,13 @@ public class DirectChannel {
     }
     
     /**
+     * Returns the endpoint ID for the direct channel
+     */
+    public Stub getLocalStub() {
+      return conduit.getId();
+    }
+    
+    /**
      * when the initial number of members is known, this method is invoked
      * to ensure that connections to those members can be established in a
      * reasonable amount of time.  See bug 39848 
@@ -113,6 +121,15 @@ public class DirectChannel {
     public void setMembershipSize(int numberOfMembers) {
       conduit.setMaximumHandshakePoolSize(numberOfMembers);
     }
+    
+    /**
+     * Returns the cancel criterion for the channel,
+     * which will note if the channel is abnormally
+     * closing
+     */
+    public CancelCriterion getCancelCriterion() {
+      return conduit.getCancelCriterion();
+    }
 
     /**
      * @param mgr

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java
index 439fb4f..de469d8 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java
@@ -7,11 +7,13 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership;
 
+import java.io.File;
 import java.net.InetAddress;
 
 import com.gemstone.gemfire.distributed.internal.DMStats;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberFactory;
+import com.gemstone.gemfire.distributed.internal.membership.gms.NetLocator;
 import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
 
 /**
@@ -88,4 +90,18 @@ public class MemberFactory {
   {
     return services.newMembershipManager(listener, config, transport, stats);
   }
+  
+  /**
+   * currently this is a test method but it ought to be used by InternalLocator
+   * to create the peer location TcpHandler
+   */
+  static public NetLocator newLocatorHandler(InetAddress bindAddress,
+          File stateFile,
+          String locatorString,
+          boolean usePreferredCoordinators,
+          boolean networkPartitionDetectionEnabled) {
+    return services.newLocatorHandler(bindAddress, stateFile, locatorString,
+        usePreferredCoordinators, networkPartitionDetectionEnabled);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberServices.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberServices.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberServices.java
index 3261b08..9e6c27c 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberServices.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberServices.java
@@ -7,11 +7,13 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership;
 
+import java.io.File;
 import java.net.InetAddress;
 
 import com.gemstone.gemfire.CancelCriterion;
 import com.gemstone.gemfire.distributed.internal.DMStats;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.membership.gms.NetLocator;
 import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
 
 /**
@@ -73,4 +75,13 @@ public interface MemberServices {
   public abstract MembershipManager newMembershipManager(DistributedMembershipListener listener,
           DistributionConfig config,
           RemoteTransportConfig transport, DMStats stats);
+
+
+  /**
+   * currently this is a test method but it ought to be used by InternalLocator
+   * to create the peer location TcpHandler
+   */
+  public abstract NetLocator newLocatorHandler(InetAddress bindAddress,
+      File stateFile, String locatorString, boolean usePreferredCoordinators,
+      boolean networkPartitionDetectionEnabled);
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MembershipManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MembershipManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MembershipManager.java
index cfca7e8..85203e2 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MembershipManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MembershipManager.java
@@ -140,12 +140,6 @@ public interface MembershipManager {
   throws NotSerializableException;
   
   /**
-   * Force a reset of communication channels
-   *
-   */
-  public void reset();
-  
-  /**
    * Return a {@link Stub} referring to the given member.  A <em>null</em> may
    * be returned if the system is not employing stubs for communication.
    * 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java
index d07cd2e..d92553f 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java
@@ -7,6 +7,7 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership.gms;
 
+import java.io.File;
 import java.net.InetAddress;
 
 import com.gemstone.gemfire.CancelCriterion;
@@ -21,7 +22,9 @@ import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
 import com.gemstone.gemfire.distributed.internal.membership.MemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.NetMember;
+import com.gemstone.gemfire.distributed.internal.membership.gms.locator.GMSLocator;
 import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpHandler;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
@@ -110,7 +113,7 @@ public class GMSMemberFactory implements MemberServices {
           DistributionConfig config,
           RemoteTransportConfig transport, DMStats stats) throws DistributionException
   {
-    Services services = new Services(listener, config, transport, stats);
+    GMSMemberServices services = new GMSMemberServices(listener, config, transport, stats);
     try {
       services.init();
       services.start();
@@ -125,9 +128,19 @@ public class GMSMemberFactory implements MemberServices {
       throw e;
     }
     catch (RuntimeException e) {
-      Services.getLogger().error("Unexpected problem starting up membership services", e);
+      GMSMemberServices.getLogger().error("Unexpected problem starting up membership services", e);
       throw new SystemConnectException("Problem starting up membership services", e);
     }
     return (MembershipManager)services.getManager();
   }
+  
+  @Override
+  public NetLocator newLocatorHandler(InetAddress bindAddress,
+      File stateFile,
+      String locatorString,
+      boolean usePreferredCoordinators,
+      boolean networkPartitionDetectionEnabled) {
+    
+    return new GMSLocator(bindAddress, stateFile, locatorString, usePreferredCoordinators, networkPartitionDetectionEnabled);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberServices.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberServices.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberServices.java
new file mode 100755
index 0000000..d23389f
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberServices.java
@@ -0,0 +1,260 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import java.util.Timer;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.CancelCriterion;
+import com.gemstone.gemfire.CancelException;
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.distributed.internal.DMStats;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener;
+import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
+import com.gemstone.gemfire.distributed.internal.membership.NetView;
+import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave;
+import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger;
+import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
+import com.gemstone.gemfire.distributed.internal.membership.gms.auth.GMSAuthenticator;
+import com.gemstone.gemfire.distributed.internal.membership.gms.fd.GMSHealthMonitor;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Authenticator;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.HealthMonitor;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.JoinLeave;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Locator;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
+import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Messenger;
+import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
+import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+
+public class GMSMemberServices {
+
+  private static final Logger logger = LogService.getLogger();
+
+  private static final ThreadGroup threadGroup = LoggingThreadGroup.createThreadGroup("Membership", logger); 
+  
+  private static InternalLogWriter staticSecurityLogWriter;
+
+  final private Manager manager;
+  final private JoinLeave joinLeave;
+  private Locator locator;
+  final private HealthMonitor healthMon;
+  final private Messenger messenger;
+  final private Authenticator auth;
+  final private ServiceConfig config;
+  final private DMStats stats;
+  final private Stopper cancelCriterion;
+
+  private InternalLogWriter securityLogWriter;
+  
+  private Timer timer = new Timer("Membership Timer", true);
+  
+  
+
+  /**
+   * A common logger for membership classes
+   */
+  public static Logger getLogger() {
+    return logger;
+  }
+
+  /**
+   * The thread group for all membership threads
+   */
+  public static ThreadGroup getThreadGroup() {
+    return threadGroup;
+  }
+  
+  /**
+   * a timer used for membership tasks
+   */
+  public Timer getTimer() {
+    return this.timer;
+  }
+  
+
+
+  public GMSMemberServices(
+      DistributedMembershipListener listener, DistributionConfig config,
+      RemoteTransportConfig transport, DMStats stats) {
+    this.cancelCriterion = new Stopper();
+    this.stats = stats;
+    this.config = new ServiceConfig(transport, config);
+    this.manager = new GMSMembershipManager(listener);
+    this.joinLeave = new GMSJoinLeave();
+    this.healthMon = new GMSHealthMonitor();
+    this.messenger = new JGroupsMessenger();
+    this.auth = new GMSAuthenticator();
+  }
+  
+  protected void init() {
+    // InternalDistributedSystem establishes this log writer at boot time
+    // TODO fix this so that IDS doesn't know about Services
+    securityLogWriter = staticSecurityLogWriter;
+    staticSecurityLogWriter = null;
+    this.auth.init(this);
+    this.messenger.init(this);
+    this.manager.init(this);
+    this.joinLeave.init(this);
+    this.healthMon.init(this);
+    InternalLocator l = (InternalLocator)com.gemstone.gemfire.distributed.Locator.getLocator();
+    if (l != null) {
+      l.getLocatorHandler().setMembershipManager((MembershipManager)this.manager);
+      this.locator = (Locator)l.getLocatorHandler();
+    }
+  }
+  
+  protected void start() {
+    boolean started = false;
+    try {
+      logger.info("Membership: starting Authenticator");
+      this.auth.start();
+      logger.info("Membership: starting Messenger");
+      this.messenger.start();
+      logger.info("Membership: starting JoinLeave");
+      this.joinLeave.start();
+      logger.info("Membership: starting HealthMonitor");
+      this.healthMon.start();
+      logger.info("Membership: starting Manager");
+      this.manager.start();
+      started = true;
+    } catch (RuntimeException e) {
+      logger.fatal("Unexpected exception while booting membership services", e);
+      throw e;
+    } finally {
+      if (!started) {
+        this.manager.stop();
+        this.healthMon.stop();
+        this.joinLeave.stop();
+        this.messenger.stop();
+        this.auth.stop();
+      }
+    }
+    this.auth.started();
+    this.messenger.started();
+    this.joinLeave.started();
+    this.healthMon.started();
+    this.manager.started();
+    
+    this.manager.joinDistributedSystem();
+  }
+  
+  public void emergencyClose() {
+  }
+  
+  public void stop() {
+    logger.info("Membership: stopping services");
+    this.joinLeave.stop();
+    this.healthMon.stop();
+    this.auth.stop();
+    this.messenger.stop();
+    this.manager.stop();
+    this.timer.cancel();
+  }
+  
+  public static void setSecurityLogWriter(InternalLogWriter writer) {
+    staticSecurityLogWriter = writer;
+  }
+  
+  public LogWriter getSecurityLogWriter() {
+    return this.securityLogWriter;
+  }
+  
+  public Authenticator getAuthenticator() {
+    return auth;
+  }
+
+  public void installView(NetView v) {
+    try {
+      auth.installView(v);
+    } catch (AuthenticationFailedException e) {
+      return;
+    }
+    if (locator != null) {
+      locator.installView(v);
+    }
+    healthMon.installView(v);
+    messenger.installView(v);
+    manager.installView(v);
+  }
+
+  public Manager getManager() {
+    return manager;
+  }
+
+  public Locator getLocator() {
+    return locator;
+  }
+
+  public void setLocator(Locator locator) {
+    this.locator = locator;
+  }
+
+  public JoinLeave getJoinLeave() {
+    return joinLeave;
+  }
+
+  public HealthMonitor getHealthMonitor() {
+    return healthMon;
+  }
+
+  public ServiceConfig getConfig() {
+    return this.config;
+  }
+  
+  public Messenger getMessenger() {
+    return this.messenger;
+  }
+  
+  public DMStats getStatistics() {
+    return this.stats;
+  }
+  
+  public Stopper getCancelCriterion() {
+    return this.cancelCriterion;
+  }
+  
+  
+  
+  
+  public static class Stopper extends CancelCriterion {
+    volatile String reasonForStopping = null;
+    
+    public void cancel(String reason) {
+      this.reasonForStopping = reason;
+    }
+
+    @Override
+    public String cancelInProgress() {
+      return reasonForStopping;
+    }
+    
+    public boolean isCancelInProgress() {
+      return cancelInProgress() != null;
+    }
+
+    @Override
+    public RuntimeException generateCancelledException(Throwable e) {
+      String reason = cancelInProgress();
+      if (reason == null) {
+        return null;
+      }
+      else {
+        return new ServicesStoppedException(reasonForStopping, e);
+      }
+    }
+    
+  }
+  
+  public static class ServicesStoppedException extends CancelException {
+    private static final long serialVersionUID = 2134474966059876801L;
+
+    public ServicesStoppedException(String message, Throwable cause) {
+      super(message, cause);
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java
index c65f4d0..0005ef3 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java
@@ -14,7 +14,7 @@ import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
 import com.gemstone.gemfire.internal.SocketCreator;
 
 public class GMSUtil {
-  static Logger logger = Services.getLogger();
+  static Logger logger = GMSMemberServices.getLogger();
   
   public static List<InetSocketAddress> parseLocators(String locatorsString, String bindAddress) {
     InetAddress addr = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/NetLocator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/NetLocator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/NetLocator.java
new file mode 100755
index 0000000..10339c6
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/NetLocator.java
@@ -0,0 +1,15 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpHandler;
+
+public interface NetLocator extends TcpHandler {
+
+  /**
+   * This must be called after booting the membership manager so
+   * that the locator can use its services
+   * @param mgr
+   */
+  public void setMembershipManager(MembershipManager mgr);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/Services.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/Services.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/Services.java
deleted file mode 100755
index 9d9c720..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/Services.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package com.gemstone.gemfire.distributed.internal.membership.gms;
-
-import java.util.Timer;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.CancelCriterion;
-import com.gemstone.gemfire.CancelException;
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.distributed.internal.DMStats;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener;
-import com.gemstone.gemfire.distributed.internal.membership.NetView;
-import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave;
-import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger;
-import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
-import com.gemstone.gemfire.distributed.internal.membership.gms.auth.GMSAuthenticator;
-import com.gemstone.gemfire.distributed.internal.membership.gms.fd.GMSHealthMonitor;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Authenticator;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.HealthMonitor;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.JoinLeave;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Locator;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Messenger;
-import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
-import com.gemstone.gemfire.internal.logging.InternalLogWriter;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
-import com.gemstone.gemfire.security.AuthenticationFailedException;
-
-public class Services {
-
-  private static final Logger logger = LogService.getLogger();
-
-  private static final ThreadGroup threadGroup = LoggingThreadGroup.createThreadGroup("Membership", logger); 
-  
-  private static InternalLogWriter staticSecurityLogWriter;
-
-  final private Manager manager;
-  final private JoinLeave joinLeave;
-  private Locator locator;
-  final private HealthMonitor healthMon;
-  final private Messenger messenger;
-  final private Authenticator auth;
-  final private ServiceConfig config;
-  final private DMStats stats;
-  final private Stopper cancelCriterion;
-
-  private InternalLogWriter securityLogWriter;
-  
-  private Timer timer = new Timer("Membership Timer", true);
-  
-  
-
-  /**
-   * A common logger for membership classes
-   */
-  public static Logger getLogger() {
-    return logger;
-  }
-
-  /**
-   * The thread group for all membership threads
-   */
-  public static ThreadGroup getThreadGroup() {
-    return threadGroup;
-  }
-  
-  /**
-   * a timer used for membership tasks
-   */
-  public Timer getTimer() {
-    return this.timer;
-  }
-  
-
-
-  protected Services(
-      DistributedMembershipListener listener, DistributionConfig config,
-      RemoteTransportConfig transport, DMStats stats) {
-    this.cancelCriterion = new Stopper();
-    this.stats = stats;
-    this.config = new ServiceConfig(transport, config);
-    this.manager = new GMSMembershipManager(listener);
-    this.joinLeave = new GMSJoinLeave();
-    this.healthMon = new GMSHealthMonitor();
-    this.messenger = new JGroupsMessenger();
-    this.auth = new GMSAuthenticator();
-  }
-  
-  protected void init() {
-    // InternalDistributedSystem establishes this log writer at boot time
-    // TODO fix this so that IDS doesn't know about Services
-    securityLogWriter = staticSecurityLogWriter;
-    staticSecurityLogWriter = null;
-    this.auth.init(this);
-    this.messenger.init(this);
-    this.manager.init(this);
-    this.joinLeave.init(this);
-    this.healthMon.init(this);
-  }
-  
-  protected void start() {
-    boolean started = false;
-    try {
-      logger.info("Membership: starting Authenticator");
-      this.auth.start();
-      logger.info("Membership: starting Messenger");
-      this.messenger.start();
-      logger.info("Membership: starting JoinLeave");
-      this.joinLeave.start();
-      logger.info("Membership: starting HealthMonitor");
-      this.healthMon.start();
-      logger.info("Membership: starting Manager");
-      this.manager.start();
-      started = true;
-    } catch (RuntimeException e) {
-      logger.fatal("Unexpected exception while booting membership services", e);
-      throw e;
-    } finally {
-      if (!started) {
-        this.manager.stop();
-        this.healthMon.stop();
-        this.joinLeave.stop();
-        this.messenger.stop();
-        this.auth.stop();
-      }
-    }
-    this.auth.started();
-    this.messenger.started();
-    this.joinLeave.started();
-    this.healthMon.started();
-    this.manager.started();
-    
-    this.manager.joinDistributedSystem();
-  }
-  
-  public void emergencyClose() {
-  }
-  
-  public void stop() {
-    this.joinLeave.stop();
-    this.healthMon.stop();
-    this.auth.stop();
-    this.messenger.stop();
-    this.manager.stop();
-    this.timer.cancel();
-  }
-  
-  public static void setSecurityLogWriter(InternalLogWriter writer) {
-    staticSecurityLogWriter = writer;
-  }
-  
-  public LogWriter getSecurityLogWriter() {
-    return this.securityLogWriter;
-  }
-  
-  public Authenticator getAuthenticator() {
-    return auth;
-  }
-
-  public void installView(NetView v) {
-    try {
-      auth.installView(v);
-    } catch (AuthenticationFailedException e) {
-      return;
-    }
-    if (locator != null) {
-      locator.installView(v);
-    }
-    healthMon.installView(v);
-    messenger.installView(v);
-    manager.installView(v);
-  }
-
-  public Manager getManager() {
-    return manager;
-  }
-
-  public Locator getLocator() {
-    return locator;
-  }
-
-  public void setLocator(Locator locator) {
-    this.locator = locator;
-  }
-
-  public JoinLeave getJoinLeave() {
-    return joinLeave;
-  }
-
-  public HealthMonitor getHealthMonitor() {
-    return healthMon;
-  }
-
-  public ServiceConfig getConfig() {
-    return this.config;
-  }
-  
-  public Messenger getMessenger() {
-    return this.messenger;
-  }
-  
-  public DMStats getStatistics() {
-    return this.stats;
-  }
-  
-  public Stopper getCancelCriterion() {
-    return this.cancelCriterion;
-  }
-  
-  
-  
-  
-  public static class Stopper extends CancelCriterion {
-    volatile String reasonForStopping = null;
-    
-    public void cancel(String reason) {
-      this.reasonForStopping = reason;
-    }
-
-    @Override
-    public String cancelInProgress() {
-      return reasonForStopping;
-    }
-    
-    public boolean isCancelInProgress() {
-      return cancelInProgress() != null;
-    }
-
-    @Override
-    public RuntimeException generateCancelledException(Throwable e) {
-      String reason = cancelInProgress();
-      if (reason == null) {
-        return null;
-      }
-      else {
-        return new ServicesStoppedException(reasonForStopping, e);
-      }
-    }
-    
-  }
-  
-  public static class ServicesStoppedException extends CancelException {
-    private static final long serialVersionUID = 2134474966059876801L;
-
-    public ServicesStoppedException(String message, Throwable cause) {
-      super(message, cause);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
index c008171..518e183 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
@@ -2,14 +2,14 @@ package com.gemstone.gemfire.distributed.internal.membership.gms.auth;
 
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Authenticator;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 
 public class GMSAuthenticator implements Authenticator {
 
   @Override
-  public void init(Services s) {
+  public void init(GMSMemberServices s) {
     // TODO Auto-generated method stub
 
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index b1f5664..4ad271f 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -3,13 +3,13 @@ package com.gemstone.gemfire.distributed.internal.membership.gms.fd;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.HealthMonitor;
 
 /** Failure Detection */
 public class GMSHealthMonitor implements HealthMonitor {
 
-  private Services services;
+  private GMSMemberServices services;
   private NetView currentView;
 
   public static void loadEmergencyClasses() {
@@ -53,7 +53,7 @@ public class GMSHealthMonitor implements HealthMonitor {
   }
 
   @Override
-  public void init(Services s) {
+  public void init(GMSMemberServices s) {
     // TODO Auto-generated method stub
     
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java
index 082ea0a..f414d3f 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java
@@ -1,14 +1,14 @@
 package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
 
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 
 /**
  * Services in GMS all implement this interface
  *
  */
 public interface Service {
-  void init(Services s);
+  void init(GMSMemberServices s);
 
   /**
    * called after all services have been initialized 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
index 902e1f6..576b250 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
@@ -25,7 +25,8 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSUtil;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.NetLocator;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Locator;
 import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
 import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
@@ -36,19 +37,17 @@ import com.gemstone.gemfire.internal.VersionedObjectInput;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 
-public class GMSLocator implements TcpHandler, Locator {
+public class GMSLocator implements Locator, NetLocator {
 
   private static final int LOCATOR_FILE_STAMP = 0x7b8cf741;
   
   private static final Logger logger = LogService.getLogger();
 
-  private final int port;
-  private final InetAddress bindAddress;
   private final boolean usePreferredCoordinators;
   private final boolean networkPartitionDetectionEnabled;
   private final String locatorString;
   private final List<InetSocketAddress> locators;
-  private Services services;
+  private GMSMemberServices services;
   
   private Set<InternalDistributedMember> registrants = new HashSet<InternalDistributedMember>();
 
@@ -57,22 +56,17 @@ public class GMSLocator implements TcpHandler, Locator {
   private File viewFile;
 
   /**
-   * @param mgr               the membership manager
-   * @param port              the tcp/ip server socket port number
-   * @param bindAddress      network address to bind to
+   * @param bindAddress       network address that TcpServer will bind to
    * @param stateFile         the file to persist state to/recover from
    * @param locatorString     location of other locators (bootstrapping, failover)
    * @param usePreferredCoordinators    true if the membership coordinator should be a Locator
    * @param networkPartitionDetectionEnabled true if network partition detection is enabled
    */
-  public GMSLocator(int port,
-                      InetAddress bindAddress,
+  public GMSLocator(  InetAddress bindAddress,
                       File stateFile,
                       String locatorString,
                       boolean usePreferredCoordinators,
                       boolean networkPartitionDetectionEnabled) {
-    this.port = port;
-    this.bindAddress = bindAddress;
     this.usePreferredCoordinators = usePreferredCoordinators;
     this.networkPartitionDetectionEnabled = networkPartitionDetectionEnabled;
     this.locatorString = locatorString;
@@ -84,11 +78,7 @@ public class GMSLocator implements TcpHandler, Locator {
     this.viewFile = stateFile;
   }
   
-  /**
-   * This must be called after booting the membership manager so
-   * that the locator can use its services
-   * @param svc
-   */
+  @Override
   public void setMembershipManager(MembershipManager mgr) {
     logger.info("Peer locator is connecting to local membership services");
     services = ((GMSMembershipManager)mgr).getServices();
@@ -96,6 +86,7 @@ public class GMSLocator implements TcpHandler, Locator {
     this.view = services.getJoinLeave().getView();
   }
   
+  @Override
   public void init(TcpServer server) {
     recover();
   }
@@ -108,6 +99,7 @@ public class GMSLocator implements TcpHandler, Locator {
     }
   }
 
+  @Override
   public void installView(NetView view) {
     synchronized(this.registrants) {
       registrants.clear();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index f94d9c4..3059890 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -14,9 +14,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.logging.log4j.Logger;
 
-import com.gemstone.gemfire.CancelCriterion;
 import com.gemstone.gemfire.SystemConnectException;
-import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionManager;
 import com.gemstone.gemfire.distributed.internal.DistributionMessage;
@@ -24,7 +22,7 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSUtil;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.JoinLeave;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.MessageHandler;
 import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoordinatorRequest;
@@ -36,7 +34,7 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messages.LeaveRe
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.RemoveMemberMessage;
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.ViewAckMessage;
 import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
+import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 
 /**
@@ -57,10 +55,13 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
   private static final int VIEW_INSTALLATION_TIMEOUT = Integer.getInteger("geode.view-ack-timeout", 12500);
 
   /** stall time to wait for concurrent join/leave/remove requests to be received */
-  private static final long MEMBER_REQUEST_COLLECTION_INTERVAL = Long.getLong("geode.member-request-collection-interval", 5000);
+  private static final long MEMBER_REQUEST_COLLECTION_INTERVAL = Long.getLong("geode.member-request-collection-interval", 2000);
+
+  /** time to wait for a leave request to be transmitted by jgroups */
+  private static final long LEAVE_MESSAGE_SLEEP_TIME = Long.getLong("geode.leave-message-sleep-time", 2000);
   
   /** membership logger */
-  private static final Logger logger = Services.getLogger();
+  private static final Logger logger = GMSMemberServices.getLogger();
 
 
   /** the view ID where I entered into membership */
@@ -69,7 +70,7 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
   /** my address */
   private InternalDistributedMember localAddress;
 
-  private Services services;
+  private GMSMemberServices services;
   
   private boolean isConnected;
 
@@ -204,37 +205,25 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
    * @param incomingRequest
    */
   private void processJoinRequest(JoinRequestMessage incomingRequest) {
-    NetView v = currentView;
-    if (!isCoordinator && v != null) {
-      // forward the request to the coordinator
-      logger.info("forwarding join request from " + incomingRequest.getMemberID() + " to " + v.getCoordinator());
-      incomingRequest.setRecipient(v.getCoordinator());
+    Object creds = incomingRequest.getCredentials();
+    if (creds != null) {
+      String rejection = null;
       try {
-        services.getMessenger().send(incomingRequest);
-      } catch (IOException ignored) {
-        // this isn't possible since this was an incoming message
+        rejection = services.getAuthenticator().authenticate(incomingRequest.getMemberID(), creds);
+      } catch (AuthenticationFailedException e) {
+        rejection = e.getMessage();
       }
-    } else {
-      Object creds = incomingRequest.getCredentials();
-      if (creds != null) {
-        String rejection = null;
+      if (rejection != null  &&  rejection.length() > 0) {
+        JoinResponseMessage m = new JoinResponseMessage(rejection);
+        m.setRecipient(incomingRequest.getMemberID());
         try {
-           rejection = services.getAuthenticator().authenticate(incomingRequest.getMemberID(), creds);
-        } catch (AuthenticationFailedException e) {
-          rejection = e.getMessage();
-        }
-        if (rejection != null  &&  rejection.length() > 0) {
-           JoinResponseMessage m = new JoinResponseMessage(rejection);
-           m.setRecipient(incomingRequest.getMemberID());
-           try {
-             services.getMessenger().send(m);
-           } catch (IOException e2) {
-             logger.info("unable to send join response " + rejection + " to " + incomingRequest.getMemberID(), e2);
-           }
+          services.getMessenger().send(m);
+        } catch (IOException e2) {
+          logger.info("unable to send join response " + rejection + " to " + incomingRequest.getMemberID(), e2);
         }
       }
-      recordViewRequest(incomingRequest);
     }
+    recordViewRequest(incomingRequest);
   }
   
   
@@ -318,7 +307,6 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
       viewRequests.add(request);
       viewRequests.notify();
     }
-    startCoordinatorServices();
   }
   
   
@@ -352,7 +340,6 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
         NetView newView;
         synchronized(viewInstallationLock) {
           int viewNumber = currentView.getViewId() + 5;
-          startCoordinatorServices();
           List<InternalDistributedMember> mbrs = new ArrayList<InternalDistributedMember>(currentView.getMembers());
           mbrs.add(localAddress);
           List<InternalDistributedMember> leaving = new ArrayList<InternalDistributedMember>();
@@ -363,6 +350,7 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
               Collections.EMPTY_LIST);
         }
         sendView(newView);
+        startCoordinatorServices();
       }
     } finally {
       stateLock.writeLock().unlock();
@@ -566,6 +554,25 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
           }
         }
       }
+      if (!this.isCoordinator) {
+        // get rid of outdated requests
+        synchronized(viewRequests) {
+          for (Iterator<DistributionMessage> it = viewRequests.iterator(); it.hasNext(); ) {
+            DistributionMessage m = it.next();
+            if (m instanceof JoinRequestMessage) {
+              it.remove();
+            } else if (m instanceof LeaveRequestMessage) {
+              if (!currentView.contains(((LeaveRequestMessage)m).getMemberID())) {
+                it.remove();
+              }
+            } else if (m instanceof RemoveMemberMessage) {
+              if (!currentView.contains(((RemoveMemberMessage)m).getMemberID())) {
+                it.remove();
+              }
+            }
+          }
+        }
+      }
     }
   }
   
@@ -580,7 +587,8 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
   /** invoke this under the viewInstallationLock */
   private void startCoordinatorServices() {
     if (viewCreator == null || viewCreator.isShutdown()) {
-      viewCreator = new ViewCreator("Geode Membership View Creator", Services.getThreadGroup());
+      viewCreator = new ViewCreator(Version.CURRENT.getProductName()
+          +" Membership View Creator", GMSMemberServices.getThreadGroup());
       viewCreator.setDaemon(true);
       viewCreator.start();
     }
@@ -660,6 +668,8 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
             m.setRecipients(newView.getMembers());
             try {
               services.getMessenger().send(m);
+              try { Thread.sleep(LEAVE_MESSAGE_SLEEP_TIME); }
+              catch (InterruptedException e) { Thread.currentThread().interrupt(); }
             } catch (IOException e) {
               logger.info("JoinLeave: unable to notify remaining members shutdown due to i/o exception", e);
             }
@@ -701,7 +711,7 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
   }
   
   @Override
-  public void init(Services s) {
+  public void init(GMSMemberServices s) {
     this.services = s;
     services.getMessenger().addHandler(JoinRequestMessage.class, this);
     services.getMessenger().addHandler(JoinResponseMessage.class, this);
@@ -837,7 +847,11 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
                 }
               } else {
                 // time to create a new membership view
-                requests = new ArrayList<DistributionMessage>(viewRequests);
+                if (requests == null) {
+                  requests = new ArrayList<DistributionMessage>(viewRequests);
+                } else {
+                  requests.addAll(viewRequests);
+                }
                 viewRequests.clear();
                 okayToCreateView = System.currentTimeMillis() + MEMBER_REQUEST_COLLECTION_INTERVAL;
               }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/AddressManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/AddressManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/AddressManager.java
index ff03bfd..9f2a98d 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/AddressManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/AddressManager.java
@@ -15,7 +15,7 @@ import org.jgroups.stack.IpAddress;
 import org.jgroups.stack.Protocol;
 import org.jgroups.util.Responses;
 
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 
 /**
  * JGroups will not send messages that have IpAddress destination addresses.
@@ -29,7 +29,7 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
  */
 public class AddressManager extends Protocol {
 
-  private static final Logger logger = Services.getLogger();
+  private static final Logger logger = GMSMemberServices.getLogger();
   
   private UDP udp;
   private Method setPingData;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
index ec8a0fa..acfbc53 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
@@ -52,12 +52,13 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
 import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.MessageHandler;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Messenger;
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinResponseMessage;
 import com.gemstone.gemfire.internal.ClassPathLoader;
 import com.gemstone.gemfire.internal.HeapDataOutputStream;
+import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.internal.VersionedDataInputStream;
@@ -70,7 +71,7 @@ import com.gemstone.gemfire.internal.tcp.MemberShunnedException;
 
 public class JGroupsMessenger implements Messenger {
 
-  private static final Logger logger = Services.getLogger();
+  private static final Logger logger = GMSMemberServices.getLogger();
 
   /**
    * The system property that specifies the name of a file from which to read
@@ -97,7 +98,7 @@ public class JGroupsMessenger implements Messenger {
   JChannel myChannel;
   InternalDistributedMember localAddress;
   JGAddress jgAddress;
-  Services services;
+  GMSMemberServices services;
 
   /** handlers that receive certain classes of messages instead of the Manager */
   Map<Class, MessageHandler> handlers = new ConcurrentHashMap<Class, MessageHandler>();
@@ -114,7 +115,7 @@ public class JGroupsMessenger implements Messenger {
   }
 
   @Override
-  public void init(Services s) {
+  public void init(GMSMemberServices s) {
     this.services = s;
 
     RemoteTransportConfig transport = services.getConfig().getTransport();
@@ -229,7 +230,7 @@ public class JGroupsMessenger implements Messenger {
     try {
       
       myChannel.setReceiver(new JGroupsReceiver());
-      myChannel.connect("Geode");
+      myChannel.connect("AG"); // apache g***** (whatever we end up calling it)
       
     } catch (IllegalStateException e) {
       throw new SystemConnectException("unable to create jgroups channel", e);
@@ -239,16 +240,6 @@ public class JGroupsMessenger implements Messenger {
     
     establishLocalAddress();
     
-    DistributionConfig config = services.getConfig().getDistributionConfig();
-    boolean isLocator = (MemberAttributes.DEFAULT.getVmKind() == DistributionManager.LOCATOR_DM_TYPE); 
-    
-    localAddress = new InternalDistributedMember(jgAddress.getInetAddress(),
-        jgAddress.getPort(), config.getEnableNetworkPartitionDetection(),
-        isLocator, MemberAttributes.DEFAULT);
-
-    UUID uuid = this.jgAddress;
-    ((GMSMember)localAddress.getNetMember()).setUUID(uuid);
-    
     try {
       logger.info("Messenger established the local identity as {} localHost is {}", localAddress, SocketCreator.getLocalHost());
     } catch (UnknownHostException e) {
@@ -299,7 +290,7 @@ public class JGroupsMessenger implements Messenger {
       this.jgAddress = new JGAddress(logicalAddress, ipaddr);
     }
     else {
-      UDP udp = (UDP)myChannel.getProtocolStack().findProtocol("UDP");
+      UDP udp = (UDP)myChannel.getProtocolStack().getTransport();
 
       try {
         Method getAddress = UDP.class.getDeclaredMethod("getPhysicalAddress");
@@ -327,9 +318,23 @@ public class JGroupsMessenger implements Messenger {
         }
       }
     }
+  
+    // install the address in the JGroups channel protocols
     myChannel.down(new Event(Event.SET_LOCAL_ADDRESS, this.jgAddress));
-  }
 
+    DistributionConfig config = services.getConfig().getDistributionConfig();
+    boolean isLocator = (MemberAttributes.DEFAULT.getVmKind() == DistributionManager.LOCATOR_DM_TYPE); 
+    
+    // establish the DistributedSystem's address
+    localAddress = new InternalDistributedMember(jgAddress.getInetAddress(),
+        jgAddress.getPort(), config.getEnableNetworkPartitionDetection(),
+        isLocator, MemberAttributes.DEFAULT);
+
+    // add the JGroups logical address to the GMSMember
+    UUID uuid = this.jgAddress;
+    ((GMSMember)localAddress.getNetMember()).setUUID(uuid);
+  }
+  
   @Override
   public void beSick() {
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index 39685fb..89341cc 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -61,10 +61,9 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
 import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipTestHook;
-import com.gemstone.gemfire.distributed.internal.membership.NetMember;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.distributed.internal.membership.QuorumChecker;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberServices;
 import com.gemstone.gemfire.distributed.internal.membership.gms.SuspectMember;
 import com.gemstone.gemfire.distributed.internal.membership.gms.fd.GMSHealthMonitor;
 import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
@@ -84,15 +83,13 @@ import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.shared.StringPrintWriter;
 import com.gemstone.gemfire.internal.tcp.ConnectExceptions;
-import com.gemstone.gemfire.internal.tcp.ConnectionException;
 import com.gemstone.gemfire.internal.tcp.MemberShunnedException;
 import com.gemstone.gemfire.internal.tcp.Stub;
-import com.gemstone.gemfire.internal.tcp.TCPConduit;
 import com.gemstone.gemfire.internal.util.Breadcrumbs;
 
 public class GMSMembershipManager implements MembershipManager, Manager
 {
-  private static final Logger logger = Services.getLogger();
+  private static final Logger logger = GMSMemberServices.getLogger();
   
   /** product version to use for multicast serialization */
   volatile boolean disableMulticastForRollingUpgrade;
@@ -310,8 +307,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
 
   protected DirectChannel directChannel;
 
-  protected TCPConduit conduit;
-  
   protected MyDCReceiver dcReceiver;
   
   volatile boolean isJoining;
@@ -325,7 +320,8 @@ public class GMSMembershipManager implements MembershipManager, Manager
    * 
    * Accesses must be under the read or write lock of {@link #latestViewLock}.
    */
-  protected final Map memberToStubMap = new ConcurrentHashMap();
+  protected final Map<InternalDistributedMember, Stub> memberToStubMap = 
+      new ConcurrentHashMap<InternalDistributedMember, Stub>();
 
   /**
    * a map of direct channels (Stub) to InternalDistributedMember. key instanceof Stub
@@ -333,7 +329,8 @@ public class GMSMembershipManager implements MembershipManager, Manager
    * 
    * Accesses must be under the read or write lock of {@link #latestViewLock}.
    */
-  protected final Map stubToMemberMap = new ConcurrentHashMap();
+  protected final Map<Stub, InternalDistributedMember> stubToMemberMap = 
+      new ConcurrentHashMap<Stub, InternalDistributedMember>();
   
   /**
    * Members of the distributed system that we believe have shut down.
@@ -442,11 +439,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
    */
   protected LinkedList<StartupEvent> startupMessages = new LinkedList<StartupEvent>();
   
-  /** the type of vm we're running in. This is also in the membership id, 
-      but is needed by some methods before the membership id has been
-      created. */
-  int vmKind;
-
   /**
    * ARB: the map of latches is used to block peer handshakes till
    * authentication is confirmed.
@@ -774,7 +766,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
    */
   private SystemTimer cleanupTimer;
 
-  private Services services;
+  private GMSMemberServices services;
 
 
   @Override
@@ -836,7 +828,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
   }
   
   @Override
-  public void init(Services services) {
+  public void init(GMSMemberServices services) {
     this.services = services;
 
     Assert.assertTrue(services != null);
@@ -852,6 +844,10 @@ public class GMSMembershipManager implements MembershipManager, Manager
     if (!config.getDisableTcp()) {
       dcReceiver = new MyDCReceiver(listener);
     }
+    
+    surpriseMemberTimeout = Math.max(20 * DistributionConfig.DEFAULT_MEMBER_TIMEOUT,
+        20 * config.getMemberTimeout());
+    surpriseMemberTimeout = Integer.getInteger("gemfire.surprise-member-timeout", surpriseMemberTimeout).intValue();
   }
   
   @Override
@@ -874,13 +870,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
         MemberAttributes.DEFAULT.getVmViewId(),
         MemberAttributes.DEFAULT.getName(),
         MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes());
-
-    this.vmKind = MemberAttributes.DEFAULT.getVmKind(); // we need this during jchannel startup
-
-    surpriseMemberTimeout = Math.max(20 * DistributionConfig.DEFAULT_MEMBER_TIMEOUT,
-        20 * config.getMemberTimeout());
-    surpriseMemberTimeout = Integer.getInteger("gemfire.surprise-member-timeout", surpriseMemberTimeout).intValue();
-
   }
   
   
@@ -911,23 +900,19 @@ public class GMSMembershipManager implements MembershipManager, Manager
         MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes());
     
     if (directChannel != null) {
-      directChannel.getConduit().setVmViewID(address.getVmViewId());
+      directChannel.setLocalAddr(address);
+      Stub stub = directChannel.getLocalStub();
+      memberToStubMap.put(address, stub);
+      stubToMemberMap.put(stub, address);
     }
 
-    // in order to debug startup issues it we need to announce the membership
+    this.hasConnected = true;
+
+    // in order to debug startup issues we need to announce the membership
     // ID as soon as we know it
     logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_entered_into_membership_in_group_0_with_id_1,
         new Object[]{address}));
 
-    if (!services.getConfig().getDistributionConfig().getDisableTcp()) {
-      this.conduit = directChannel.getConduit();
-      directChannel.setLocalAddr(address);
-      Stub stub = conduit.getId();
-      memberToStubMap.put(address, stub);
-      stubToMemberMap.put(stub, address);
-    }
-    
-    this.hasConnected = true;
   }
   
   @Override
@@ -1523,7 +1508,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
       logger.debug("Membership: waiting until the system is ready for events");
     }
     for (;;) {
-      conduit.getCancelCriterion().checkCancelInProgress(null);
+      directChannel.getCancelCriterion().checkCancelInProgress(null);
       synchronized (startupLock) {
         // Now check using a memory fence and synchronization.
         if (processingEvents)
@@ -1534,7 +1519,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
         }
         catch (InterruptedException e) {
           interrupted = true;
-          conduit.getCancelCriterion().checkCancelInProgress(e);
+          directChannel.getCancelCriterion().checkCancelInProgress(e);
         }
         finally {
           if (interrupted) {
@@ -1631,7 +1616,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
     return address;
   }
   
-  public Services getServices() {
+  public GMSMemberServices getServices() {
     return services;
   }
 
@@ -1707,7 +1692,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
     services.getAuthenticator().emergencyClose();
 
     
-    // TODO: could we guarantee not to allocate objects?  We're using Darrel's 
+    // could we guarantee not to allocate objects?  We're using Darrel's 
     // factory, so it's possible that an unsafe implementation could be
     // introduced here.
 //    stubToMemberMap.clear();
@@ -2161,20 +2146,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
     }
   }
   
-  /**
-   * @throws ConnectionException if the conduit has stopped
-   */
-  public void reset() throws DistributionException
-  {
-    if (conduit != null) {
-      try {
-        conduit.restart();
-      } catch (ConnectionException e) {
-        throw new DistributionException(LocalizedStrings.GroupMembershipService_UNABLE_TO_RESTART_CONDUIT.toLocalizedString(), e);
-      }
-    }
-  }
-
   // MembershipManager method
   @Override
   public void forceUDPMessagingForCurrentThread() {
@@ -2195,9 +2166,10 @@ public class GMSMembershipManager implements MembershipManager, Manager
     if (shutdownInProgress) {
       throw new DistributedSystemDisconnectedException(LocalizedStrings.GroupMembershipService_DISTRIBUTEDSYSTEM_IS_SHUTTING_DOWN.toLocalizedString(), this.shutdownCause);
     }
-    // Bogus stub object if direct channels not being used
-    if (conduit == null)
+
+    if (services.getConfig().getDistributionConfig().getDisableTcp()) {
       return new Stub(m.getInetAddress(), m.getPort(), m.getVmViewId());
+    }
     
     // Return existing one if it is already in place
     Stub result;
@@ -2975,7 +2947,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
 
   @Override
   public void setSecurityLogWriter(InternalLogWriter writer) {
-    Services.setSecurityLogWriter(writer);
+    GMSMemberServices.setSecurityLogWriter(writer);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
index 6298cf6..64c9301 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
@@ -121,7 +121,8 @@ public class LogService extends LogManager {
   private static final void setLog4jConfigFileProperty() {
     // fix bug #52175
     final URL configInClasspath = ConfigLocator.findConfigInClasspath();
-    if (configInClasspath != null ) {
+    if (configInClasspath != null
+        && !configInClasspath.getPath().contains("jgroups-")) { // jgroups jar contains a log4j config file!
       // Log4J 2 will find the configuration file in classpath so do nothing
       configFileInformation = "Using log4j configuration found in classpath: '" + configInClasspath.toString() + "'";
       StatusLogger.getLogger().info(configFileInformation);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
index bac9650..e286ff1 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
@@ -872,6 +872,7 @@ public class TCPConduit implements Runnable {
   
   public void setLocalAddr(InternalDistributedMember addr) {
     localAddr = addr;
+    this.id.setViewID(addr.getVmViewId());
   }
   
   public InternalDistributedMember getLocalId() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java
index 778ba3f..fd955e1 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/MembershipJUnitTest.java
@@ -7,10 +7,38 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
 import junit.framework.TestCase;
 
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.DMStats;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.LonerDistributionManager.DummyDMStats;
+import com.gemstone.gemfire.distributed.internal.PoolStatHelper;
+import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
+import com.gemstone.gemfire.distributed.internal.membership.gms.NetLocator;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpHandler;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpServer;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.tcp.Stub;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
@@ -27,14 +55,84 @@ public class MembershipJUnitTest extends TestCase {
   protected void tearDown() throws Exception {
     super.tearDown();
   }
+  
+  /**
+   * This test creates a locator with a colocated
+   * membership manager and then creates a second
+   * manager that joins the system of the first.
+   * 
+   * It then makes assertions about the state of
+   * the membership view, closes one of the managers
+   * and makes more assertions.
+   */
+  @Test
+  public void testJoinLeave() throws Exception {
+    
+    MembershipManager m1=null, m2=null;
+    Locator l = null;
+    
+    try {
+      LogService.initialize();
+      
+      MemberAttributes.setDefaults(MemberAttributes.DEFAULT.getPort(),
+          MemberAttributes.DEFAULT.getVmPid(),
+          DistributionManager.NORMAL_DM_TYPE,
+          MemberAttributes.DEFAULT.getVmViewId(),
+          MemberAttributes.DEFAULT.getName(),
+          MemberAttributes.DEFAULT.getGroups(), MemberAttributes.DEFAULT.getDurableClientAttributes());
+      
+      // boot up a locator
+      int port = AvailablePortHelper.getRandomAvailableTCPPort();
+      InetAddress localHost = SocketCreator.getLocalHost();
+      l = Locator.startLocator(port, new File("testJoinLeave.dat"), localHost);
+
+      // create configuration objects
+      Properties nonDefault = new Properties();
+      nonDefault.put(DistributionConfig.DISABLE_TCP_NAME, "true");
+      nonDefault.put(DistributionConfig.MCAST_PORT_NAME, "0");
+      nonDefault.put(DistributionConfig.LOG_FILE_NAME, "");
+      nonDefault.put(DistributionConfig.LOG_LEVEL_NAME, "fine");
+      nonDefault.put(DistributionConfig.LOCATORS_NAME, localHost.getHostName()+'['+port+']');
+      DistributionConfigImpl config = new DistributionConfigImpl(nonDefault);
+      RemoteTransportConfig transport = new RemoteTransportConfig(config);
+
+      // start the first membership manager
+      MembershipListener listener1 = new MembershipListener();
+      DMStats stats1 = new MyStats();
+      m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1);
 
+      // start the second membership manager
+      MembershipListener listener2 = new MembershipListener();
+      DMStats stats2 = new MyStats();
+      m2 = MemberFactory.newMembershipManager(listener2, config, transport, stats2);
+      
+      assert m2.getView().size() == 2;
+      assert m1.getView().size() == 2;
+      assert m1.getView().getViewId() == m2.getView().getViewId();
+      
+      m2.shutdown();
+      assert !m2.isConnected();
+      
+      assert m1.getView().size() == 1;
+    }
+    finally {
+      if (m2 != null) {
+        m2.shutdown();
+      }
+      if (m1 != null) {
+        m1.shutdown();
+      }
+      if (l != null) {
+        l.stop();
+      }
+    }
+    
+  }
+  
   /**
    * Test that failed weight calculations are correctly performed.  See bug #47342
    * @throws Exception
    */
-  public void testFailedWeight() throws Exception {
-    fail("testFailedWeight must be reimplemented for jgroups replacement");
-  }
   public void _testFailedWeight() throws Exception {
 //    // in #47342 a new view was created that contained a member that was joining but
 //    // was no longer reachable.  The member was included in the failed-weight and not
@@ -89,5 +187,59 @@ public class MembershipJUnitTest extends TestCase {
 //    assertEquals("failure weight calculation is incorrect", 10, failedWeight);
 //    assertTrue(!failedMembers.contains(members[members.length-2]));
   }
+  
+  static class MembershipListener implements DistributedMembershipListener {
+
+    @Override
+    public void viewInstalled(NetView view) {
+    }
+
+    @Override
+    public void quorumLost(Set<InternalDistributedMember> failures,
+        List<InternalDistributedMember> remainingMembers) {
+    }
+
+    @Override
+    public void newMemberConnected(InternalDistributedMember m, Stub stub) {
+    }
 
+    @Override
+    public void memberDeparted(InternalDistributedMember id, boolean crashed,
+        String reason) {
+    }
+
+    @Override
+    public void memberSuspect(InternalDistributedMember suspect,
+        InternalDistributedMember whoSuspected) {
+    }
+
+    @Override
+    public void messageReceived(DistributionMessage o) {
+    }
+
+    @Override
+    public boolean isShutdownMsgSent() {
+      return false;
+    }
+
+    @Override
+    public void membershipFailure(String reason, Throwable t) {
+    }
+
+    @Override
+    public DistributionManager getDM() {
+      return null;
+    }
+    
+  }
+  
+  static class MyStats extends DummyDMStats {
+    
+  }
+
+  public static class DummyPoolStatHelper implements PoolStatHelper {
+    public void startJob() {}
+    public void endJob(){}
+  }
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04cc2d9b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
index e0a8749..a4eaa40 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
@@ -23,7 +23,7 @@ import dunit.DistributedTestCase.WaitCriterion;
 
 /**
  * This helper class provides access to membership manager information that
- * is not other wise public
+ * is not otherwise public
  * @author bruce
  * @since 5.5
  */
@@ -150,5 +150,5 @@ public class MembershipManagerHelper
     getMembershipManager(msys).uncleanShutdown("test is forcing disconnect", new ForcedDisconnectException("test is forcing disconnect"));
     MembershipManagerHelper.inhibitForcedDisconnectLogging(false);
   }
-    
+  
 }


Mime
View raw message