geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [13/14] incubator-geode git commit: jgroups source is now removed from asf branch GEODE-77 and is a downloaded dependency. Able to start/stop a locator and a server via gfsh but there is no HA or authentication in the membership system.
Date Mon, 27 Jul 2015 20:27:57 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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 6cf1fff..439fb4f 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
@@ -11,7 +11,7 @@ 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.jgroup.JGroupMemberFactory;
+import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMemberFactory;
 import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
 
 /**
@@ -23,7 +23,7 @@ import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
  */
 public class MemberFactory {
   
-  private static final MemberServices services = new JGroupMemberFactory();
+  private static final MemberServices services = new GMSMemberFactory();
 
   /**
    * Return a blank NetMember (used by externalization)
@@ -45,8 +45,8 @@ public class MemberFactory {
    * @return the new NetMember
    */
   static public NetMember newNetMember(InetAddress i, int p,
-      boolean splitBrainEnabled, boolean canBeCoordinator, MemberAttributes payload) {
-    return services.newNetMember(i, p, splitBrainEnabled, canBeCoordinator, payload);
+      boolean splitBrainEnabled, boolean canBeCoordinator, short version, MemberAttributes payload) {
+    return services.newNetMember(i, p, splitBrainEnabled, canBeCoordinator, payload, version);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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 5a6df84..3261b08 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
@@ -9,6 +9,7 @@ package com.gemstone.gemfire.distributed.internal.membership;
 
 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.internal.admin.remote.RemoteTransportConfig;
@@ -36,10 +37,11 @@ public interface MemberServices {
    * @param splitBrainEnabled whether the member has this feature enabled
    * @param canBeCoordinator whether the member can be membership coordinator
    * @param payload the payload to be associated with the resulting object
+   * @param version TODO
    * @return the new NetMember
    */
   public abstract NetMember newNetMember(InetAddress i, int port, 
-      boolean splitBrainEnabled, boolean canBeCoordinator, MemberAttributes payload);
+      boolean splitBrainEnabled, boolean canBeCoordinator, MemberAttributes payload, short version);
 
   /**
    * Return a new NetMember representing current host
@@ -61,14 +63,14 @@ public interface MemberServices {
   
    /**
    * Create a new MembershipManager
-   * 
+   * @param stopper TODO
    * @param listener the listener to notify for callbacks
    * @param transport holds configuration information that can be used by the manager to configure itself
    * @param stats a gemfire statistics collection object for communications stats
+   * 
    * @return a MembershipManager
    */
   public abstract MembershipManager newMembershipManager(DistributedMembershipListener listener,
           DistributionConfig config,
-          RemoteTransportConfig transport,
-          DMStats stats);
+          RemoteTransportConfig transport, DMStats stats);
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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 0683cd7..8b861b1 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
@@ -8,15 +8,16 @@
 package com.gemstone.gemfire.distributed.internal.membership;
 
 import java.io.NotSerializableException;
-import java.net.DatagramSocket;
-import java.util.Set;
 import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeoutException;
 
 import com.gemstone.gemfire.SystemFailure;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.DistributionMessage;
 import com.gemstone.gemfire.distributed.internal.DistributionStats;
+import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.tcp.Stub;
 
 /**
@@ -190,7 +191,7 @@ public interface MembershipManager {
    *    process and the given distributed member
    * @since 5.1
    */
-  public HashMap getChannelStates(DistributedMember member, boolean includeMulticast);
+  public Map getChannelStates(DistributedMember member, boolean includeMulticast);
 
   /**
    * Waits for the given communication channels to reach the associated
@@ -203,7 +204,7 @@ public interface MembershipManager {
    *    Thrown if the thread is interrupted
    * @since 5.1
    */
-  public void waitForChannelState(DistributedMember member, HashMap channelState)
+  public void waitForChannelState(DistributedMember member, Map channelState)
     throws InterruptedException;
   
   /**
@@ -340,5 +341,11 @@ public interface MembershipManager {
    * @param checker the QuorumChecker instance
    */
   public void releaseQuorumChecker(QuorumChecker checker);
+  
+  /**
+   * sets the log writer for authentication logging
+   * @param writer
+   */
+  public void setSecurityLogWriter(InternalLogWriter writer);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetMember.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetMember.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetMember.java
index 4b561ef..16d3cc5 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetMember.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetMember.java
@@ -7,6 +7,9 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership;
 
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 import java.net.InetAddress;
 
 /**
@@ -23,7 +26,7 @@ public interface NetMember
 
   public abstract MemberAttributes getAttributes();
 
-  public abstract InetAddress getIpAddress();
+  public abstract InetAddress getInetAddress();
 
   public abstract int getPort();
   
@@ -31,6 +34,8 @@ public interface NetMember
 
   public abstract boolean isMulticastAddress();
   
+  public short getVersionOrdinal();
+  
   /**
    * return a flag stating whether the member has network partition detection enabled
    * @since 5.6
@@ -41,7 +46,9 @@ public interface NetMember
    * return a flag stating whether the member can be the membership coordinator
    * @since 5.6
    */
-  public abstract boolean canBeCoordinator();
+  public abstract boolean preferredForCoordinator();
+  
+  public byte getMemberWeight();
 
   /**
    * Establishes an order between 2 addresses. Assumes other contains non-null IpAddress.
@@ -66,5 +73,11 @@ public interface NetMember
   public abstract int hashCode();
 
   public abstract String toString();
+  
+  /** write identity information not known by DistributedMember instances */
+  public abstract void writeAdditionalData(DataOutput out) throws IOException;
+  
+  /** read identity information not known by DistributedMember instances */
+  public abstract void readAdditionalData(DataInput in) throws ClassNotFoundException, IOException;
 
  }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
index d68a28c..e6c2b45 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
@@ -7,92 +7,289 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership;
 
-import java.util.Collection;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
-import java.util.Vector;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
+import com.gemstone.gemfire.internal.Version;
 
 
 /**
- * The NetView class tracks the 'leader'
- * process for split-brain detection/handling.
+ * The NetView class represents a membership view.  Note that 
+ * this class is not synchronized, so take that under advisement
+ * if you decide to modify a view with add() or remove().
  * 
- * @author bruce
  * @since 5.5 
  */
-public class NetView extends Vector<InternalDistributedMember> {
+public class NetView implements DataSerializableFixedID {
   private static final long serialVersionUID = -8888347937416039434L;
-  /**
-   * The lead member is used in jgroups to determine which
-   * members survive a network partitioning event. 
-   */
-  private transient NetMember leadmember;
+  private int viewId;
+  private List<InternalDistributedMember> members;
+  private List<InternalDistributedMember> shutdownMembers;
+  private List<InternalDistributedMember> crashedMembers;
+  private InternalDistributedMember creator;
+  private Set<InternalDistributedMember> hashedMembers;
   
-  private transient NetMember creator;
+  public NetView() {
+    viewId = 0;
+    members = new ArrayList<InternalDistributedMember>(4);
+    this.hashedMembers = new HashSet<InternalDistributedMember>(members);
+    shutdownMembers = Collections.EMPTY_LIST;
+    crashedMembers = Collections.EMPTY_LIST;
+    creator = null;
+  }
+
+  public NetView(InternalDistributedMember creator) {
+    viewId = 0;
+    members = new ArrayList<InternalDistributedMember>(4);
+    members.add(creator);
+    this.hashedMembers = new HashSet<InternalDistributedMember>(members);
+    shutdownMembers = Collections.EMPTY_LIST;
+    crashedMembers = Collections.EMPTY_LIST;
+    this.creator = creator;
+  }
+
+  // legacy method for JGMM
+  public NetView(int size, long viewId) {
+    this.viewId = (int)viewId;
+    members = new ArrayList<InternalDistributedMember>(size);
+    this.hashedMembers = new HashSet<InternalDistributedMember>(members);
+    shutdownMembers = Collections.EMPTY_LIST;
+    crashedMembers = Collections.EMPTY_LIST;
+    creator = null;
+  }
+
+  public NetView(NetView other, int viewId) {
+    this.creator = other.creator;
+    this.viewId = viewId;
+    this.members = new ArrayList<InternalDistributedMember>(other.members);
+    this.hashedMembers = new HashSet<InternalDistributedMember>(other.members);
+    this.shutdownMembers = new ArrayList<InternalDistributedMember>(other.shutdownMembers);
+    this.crashedMembers = new ArrayList<InternalDistributedMember>(other.crashedMembers);
+  }
+  public NetView(InternalDistributedMember creator,
+      int viewId,
+      List<InternalDistributedMember> mbrs,
+      List<InternalDistributedMember> shutdowns,
+      List<InternalDistributedMember> crashes) {
+    this.creator = creator;
+    this.viewId = viewId;
+    this.members = mbrs;
+    this.hashedMembers = new HashSet<InternalDistributedMember>(mbrs);
+    this.shutdownMembers = shutdowns;
+    this.crashedMembers = crashes;
+  }
   
-  private long viewNumber;
+  public int getViewId() {
+    return this.viewId;
+  }
   
+  public InternalDistributedMember getCreator() {
+    return this.creator;
+  }
+  
+  public void setCreator(InternalDistributedMember creator) {
+    this.creator = creator;
+  }
+
+  public List<InternalDistributedMember> getMembers() {
+    return Collections.unmodifiableList(this.members);
+  }
+  
+  /**
+   * return members that are i this view but not the given old view
+   */
+  public List<InternalDistributedMember> getNewMembers(NetView olderView) {
+    List<InternalDistributedMember> result = new ArrayList<InternalDistributedMember>(members);
+    result.removeAll(olderView.getMembers());
+    return result;
+  }
+
   /**
-   * @return the view number
+   * return members added in this view
    */
-  public long getViewNumber() {
-    return this.viewNumber;
+  public List<InternalDistributedMember> getNewMembers() {
+    List<InternalDistributedMember> result = new ArrayList<InternalDistributedMember>(5);
+    for (InternalDistributedMember mbr: this.members) {
+      if (mbr.getVmViewId() == this.viewId) {
+        result.add(mbr);
+      }
+    }
+    return result;
   }
   
-  /** crashed members removed in this view change */
-  private Set suspectedMembers;
-  public NetView(int size, long viewNumber) {
-    super(size);
-    this.viewNumber = viewNumber;
+  public Object get(int i) {
+    return this.members.get(i);
   }
   
-  public NetView(Collection mbrs) {
-    throw new UnsupportedOperationException(); // must have a view number
+  public void add(InternalDistributedMember mbr) {
+    this.hashedMembers.add(mbr);
+    this.members.add(mbr);
   }
   
-  public NetView(NetView mbrs, long viewNumber) {
-    super(mbrs);
-    this.creator = mbrs.creator;
-    this.viewNumber = viewNumber;
+  public boolean remove(InternalDistributedMember mbr) {
+    this.hashedMembers.remove(mbr);
+    return this.members.remove(mbr);
   }
-  public NetView() {
-    super();
+  
+  public boolean contains(InternalDistributedMember mbr) {
+    return this.hashedMembers.contains(mbr);
   }
   
-  public NetMember getCreator() {
-    return this.creator;
+  public int size() {
+    return this.members.size();
   }
-  public void setCreator(NetMember mbr) {
-    this.creator = mbr;
+  
+  public InternalDistributedMember getLeadMember() {
+    for (InternalDistributedMember mbr: this.members) {
+      if (mbr.getVmKind() == DistributionManager.NORMAL_DM_TYPE) {
+        return mbr;
+      }
+    }
+    return null;
   }
   
-  public void setLeadMember(NetMember lead) {
-    this.leadmember = lead;
+  public InternalDistributedMember getCoordinator() {
+    synchronized(members) {
+      for (InternalDistributedMember addr: members) {
+        if (addr.getNetMember().preferredForCoordinator()) {
+          return addr;
+        }
+      }
+      if (members.size() > 0) {
+        return members.get(0);
+      }
+    }
+    return null;
+  }
+
+  public List<InternalDistributedMember> getShutdownMembers() {
+    return this.shutdownMembers;
   }
-  public NetMember getLeadMember() {
-    return this.leadmember;
+  
+  public List<InternalDistributedMember> getCrashedMembers() {
+    return this.crashedMembers;
   }
-  public synchronized Set getCrashedMembers() {
-    if (this.suspectedMembers == null) {
-      return Collections.EMPTY_SET;
+  
+  /** check to see if the given address is next in line to be coordinator */
+  public boolean shouldBeCoordinator(InternalDistributedMember who) {
+    Iterator<InternalDistributedMember> it = this.members.iterator();
+    InternalDistributedMember firstNonPreferred = null;
+    while (it.hasNext()) {
+      InternalDistributedMember mbr = it.next();
+      if (mbr.getNetMember().preferredForCoordinator()) {
+        return mbr.equals(who);
+      } else if (firstNonPreferred == null) {
+        firstNonPreferred = mbr;
+      }
     }
-    return this.suspectedMembers;
+    return (firstNonPreferred == null  ||  firstNonPreferred.equals(who));
   }
-  public synchronized void setCrashedMembers(Set mbrs) {
-    this.suspectedMembers = mbrs;
+  
+  public String toString() {
+    InternalDistributedMember lead = getLeadMember();
+    
+    StringBuilder sb = new StringBuilder(200);
+    sb.append("View[").append(creator).append('|').append(viewId).append("] members: [");
+    boolean first = true;
+    for (InternalDistributedMember mbr: this.members) {
+      if (!first) sb.append(", ");
+      sb.append(mbr);
+      if (mbr == lead) {
+        sb.append("{lead}");
+      }
+      first = false;
+    }
+    if ( !this.shutdownMembers.isEmpty() ) {
+      sb.append("]  shutdown: [");
+      first = true;
+      for (InternalDistributedMember mbr: this.shutdownMembers) {
+        if (!first) sb.append(", ");
+        sb.append(mbr);
+        first = false;
+      }
+    }
+    if ( !this.crashedMembers.isEmpty() ) {
+      sb.append("]  crashed: [");
+      first = true;
+      for (InternalDistributedMember mbr: this.crashedMembers) {
+        if (!first) sb.append(", ");
+        sb.append(mbr);
+        first = false;
+      }
+    }
+    sb.append("]");
+    return sb.toString();
   }
+
   @Override
   public synchronized boolean equals(Object arg0) {
-    return super.equals(arg0);
+    if (arg0 == this) {
+      return true;
+    }
+    if ( !(arg0 instanceof NetView) ) {
+      return false;
+    }
+    return this.members.equals(((NetView)arg0).getMembers());
   }
   @Override
   public synchronized int hashCode() {
-    return super.hashCode();
+    return this.members.hashCode();
   }
+
   @Override
-  public String toString() {
-    // this string is displayed in the product-use log file
-    return "View(creator="+creator+", viewId=" + this.viewNumber + ", " + super.toString() + ")";
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(creator, out);
+    out.writeInt(viewId);
+    writeAsArrayList(members, out);
+    writeAsArrayList(shutdownMembers, out);
+    writeAsArrayList(crashedMembers, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    creator = DataSerializer.readObject(in);
+    viewId = in.readInt();
+    members = DataSerializer.readArrayList(in);
+    this.hashedMembers = new HashSet<InternalDistributedMember>(members);
+    shutdownMembers = DataSerializer.readArrayList(in);
+    crashedMembers = DataSerializer.readArrayList(in);
+  }
+  
+  /** this will deserialize as an ArrayList */
+  private void writeAsArrayList(List list, DataOutput out) throws IOException {
+    int size;
+    if (list == null) {
+      size = -1;
+    } else {
+      size = list.size();
+    }
+    InternalDataSerializer.writeArrayLength(size, out);
+    if (size > 0) {
+      for (int i=0; i < size; i++) {
+        DataSerializer.writeObject(list.get(i), out);
+      }
+    }
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return NETVIEW;
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
new file mode 100755
index 0000000..05c5754
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMember.java
@@ -0,0 +1,457 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.jgroups.util.UUID;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.distributed.DurableClientAttributes;
+import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
+import com.gemstone.gemfire.distributed.internal.membership.NetMember;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+/**
+ * This is the fundamental representation of a member of a GemFire distributed system.
+ * 
+ * Unfortunately, this class serves two distinct functions.  First, it is the
+ * fundamental element of membership in the GemFire distributed system.  As such,
+ * it is used in enumerations and properly responds to hashing and equals() comparisons.
+ * 
+ * Second, it is used as a cheap way of representing an address.  This is
+ * unfortunate, because as a NetMember, it holds two separate port numbers: the
+ * "membership" descriptor as well as a direct communication channel.
+ * 
+ */
+public class GMSMember implements NetMember, DataSerializableFixedID {
+  private int udpPort=0;
+  private boolean shouldNotBeCoordinator;
+  private boolean splitBrainEnabled;
+  private byte memberWeight;
+  private InetAddress inetAddr;
+  private int processId;
+  private int vmKind;
+  private int vmViewId = -1;
+  private int directPort;
+  private String name;
+  private DurableClientAttributes durableClientAttributes;
+  private String[] groups;
+  private short versionOrdinal;
+  private long uuidLSBs;
+  private long uuidMSBs;
+  
+  
+  
+  // Used only by Externalization
+  public GMSMember() {
+  }
+  
+  public MemberAttributes getAttributes() {
+    return new MemberAttributes(directPort, processId,
+        vmKind, vmViewId, name, groups,
+        durableClientAttributes);
+  }
+
+  public void setAttributes(MemberAttributes p_attr) {
+    MemberAttributes attr = p_attr;
+    if (attr == null) {
+      attr = MemberAttributes.INVALID;
+    }
+    processId = attr.getVmPid();
+    vmKind = attr.getVmKind();
+    directPort = attr.getPort();
+    vmViewId = attr.getVmViewId();
+    name = attr.getName();
+    groups = attr.getGroups();
+    durableClientAttributes = attr.getDurableClientAttributes();
+  }
+  
+  /**
+   * This is the only constructor to refer to a CacheMember other
+   * than the current host.
+   */
+  public GMSMember(GMSMember m) {
+    udpPort=m.udpPort;
+    shouldNotBeCoordinator=m.shouldNotBeCoordinator;
+    splitBrainEnabled=m.splitBrainEnabled;
+    memberWeight=m.memberWeight;
+    inetAddr=m.inetAddr;
+    processId=m.processId;
+    vmKind=m.vmKind;
+    vmViewId=m.vmViewId;
+    directPort=m.directPort;
+    name=m.name;
+    durableClientAttributes=m.durableClientAttributes;
+    groups=m.groups;
+    versionOrdinal=m.versionOrdinal;
+    uuidLSBs=m.uuidLSBs;
+    uuidMSBs=m.uuidMSBs;
+  }
+
+  /**
+   * Create a CacheMember referring to the current host (as defined by
+   * the given string).
+   * 
+   * @param i the hostname, must be for the current host
+   * @param p the membership listening port
+   */
+  public GMSMember(String i, int p) {
+    setAttributes(MemberAttributes.DEFAULT);
+    udpPort=p;
+    try {
+      inetAddr=InetAddress.getByName(i);
+    } catch (UnknownHostException e) {
+      // oops
+    }
+  }
+
+  /**
+   * Create a CacheMember referring to the current host (as defined by
+   * the given string).
+   * 
+   * @param i the hostname, must be for the current host
+   * @param p the membership listening port
+   * @param splitBrainEnabled whether the member has network partition detection enabled
+   * @param canBeCoordinator whether the member can be group coordinator
+   * @param version TODO
+   */
+  public GMSMember(InetAddress i, int p, boolean splitBrainEnabled, boolean canBeCoordinator, short version) {
+    setAttributes(MemberAttributes.DEFAULT);
+    this.inetAddr = i;
+    this.udpPort=p;
+    this.splitBrainEnabled = splitBrainEnabled;
+    this.shouldNotBeCoordinator = !canBeCoordinator;
+    this.versionOrdinal = version;
+  }
+
+  public int getPort() {
+    return this.udpPort;
+  }
+
+  public boolean isMulticastAddress() {
+    return false;  //ipAddr.isMulticastAddress();
+  }
+  
+  public boolean splitBrainEnabled() {
+    return this.splitBrainEnabled;
+  }
+  
+  public boolean preferredForCoordinator() {
+    return !this.shouldNotBeCoordinator;
+  }
+  
+  public InetAddress getInetAddress() {
+    return this.inetAddr;
+  }
+  
+  public short getVersionOrdinal() {
+    return this.versionOrdinal;
+  }
+  
+  public void setVersionOrdinal(short versionOrdinal) {
+    this.versionOrdinal = versionOrdinal;
+  }
+  
+  public void setUUID(UUID u) {
+    this.uuidLSBs = u.getLeastSignificantBits();
+    this.uuidMSBs = u.getMostSignificantBits();
+  }
+  
+  /**
+   * return the jgroups logical address for this member,
+   * if it's been established
+   */
+  public UUID getUUID() {
+    if (this.uuidLSBs == 0 && this.uuidMSBs == 0) {
+      return null;
+    }
+    return new UUID(this.uuidMSBs, this.uuidLSBs);
+  }
+  
+  public long getUuidMSBs() {
+    return this.uuidMSBs;
+  }
+  
+  public long getUuidLSBs() {
+    return this.uuidLSBs;
+  }
+
+  /**
+   * Establishes an order between 2 addresses. Assumes other contains non-null IpAddress.
+   * Excludes channel_name from comparison.
+   * @return 0 for equality, value less than 0 if smaller, greater than 0 if greater.
+   */
+  public int compare(NetMember other) {
+    return compareTo(other);
+  }
+
+  /**
+   * implements the java.lang.Comparable interface
+   * @see java.lang.Comparable
+   * @param o - the Object to be compared
+   * @return a negative integer, zero, or a positive integer as this object is less than,
+   *         equal to, or greater than the specified object.
+   * @exception java.lang.ClassCastException - if the specified object's type prevents it
+   *            from being compared to this Object.
+   */
+  public int compareTo(Object o) {
+    if (o == this) {
+      return 0;
+    }
+    // obligatory type check
+    if ((o == null) || !(o instanceof GMSMember)) {
+      throw new ClassCastException(LocalizedStrings.JGroupMember_JGROUPMEMBERCOMPARETO_COMPARISON_BETWEEN_DIFFERENT_CLASSES.toLocalizedString());
+    }
+    byte[] myAddr = inetAddr.getAddress();
+    GMSMember his = (GMSMember)o;
+    byte[] hisAddr = his.inetAddr.getAddress();
+    if (myAddr != hisAddr) {
+      for (int idx=0; idx < myAddr.length; idx++) {
+        if (idx > hisAddr.length) {
+          return 1;
+        } else if (myAddr[idx] > hisAddr[idx]) {
+          return 1;
+        } else if (myAddr[idx] < hisAddr[idx]) {
+          return -1;
+        }
+      }
+    }
+    if (udpPort < his.udpPort) return -1;
+    if (his.udpPort < udpPort) return 1;
+    int result = 0;
+
+    // bug #41983, address of kill-9'd member is reused
+    // before it can be ejected from membership
+    if (result == 0) {
+      if (this.vmViewId >= 0 && his.vmViewId >= 0) {
+        if (this.vmViewId < his.vmViewId) {
+          result = -1;
+        } else if (his.vmViewId < this.vmViewId) {
+          result = 1;
+        }
+      } else if (this.processId != 0 && his.processId != 0) {
+        // starting in 8.0 we also consider the processId.  During startup
+        // we may have a message from a member that hasn't finished joining
+        // and address canonicalization may find an old address that has
+        // the same addr:port.  Since the new member doesn't have a viewId
+        // its address will be equal to the old member's address unless
+        // we also pay attention to the processId.
+        if (this.processId < his.processId){
+          result = -1;
+        } else if (his.processId < this.processId) {
+          result = 1;
+        }
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    // GemStone fix for 29125
+    if ((obj == null) || !(obj instanceof GMSMember)) {
+      return false;
+    }
+    return compareTo(obj) == 0;
+  }
+
+  @Override
+  public int hashCode() {
+    if (this.inetAddr == null) {
+      return this.udpPort;
+    }
+    return this.udpPort + inetAddr.hashCode();
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder(100);
+    sb.append("GMSMember[addr=").append(inetAddr).append(";port=").append(udpPort)
+      .append(";processId=").append(processId).append(";name=").append(name)
+      .append("]");
+    return sb.toString();
+  }
+
+  
+  public int getUdpPort() {
+    return udpPort;
+  }
+
+  public boolean isShouldNotBeCoordinator() {
+    return shouldNotBeCoordinator;
+  }
+
+  public boolean isSplitBrainEnabled() {
+    return splitBrainEnabled;
+  }
+
+  public byte getMemberWeight() {
+    return memberWeight;
+  }
+
+  public InetAddress getInetAddr() {
+    return inetAddr;
+  }
+
+  public int getProcessId() {
+    return processId;
+  }
+
+  public int getVmKind() {
+    return vmKind;
+  }
+
+  public int getVmViewId() {
+    return vmViewId;
+  }
+
+  public int getDirectPort() {
+    return directPort;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public DurableClientAttributes getDurableClientAttributes() {
+    return durableClientAttributes;
+  }
+
+  public String[] getRoles() {
+    return groups;
+  }
+
+  public void setUdpPort(int udpPort) {
+    this.udpPort = udpPort;
+  }
+
+  public void setShouldNotBeCoordinator(boolean shouldNotBeCoordinator) {
+    this.shouldNotBeCoordinator = shouldNotBeCoordinator;
+  }
+
+  public void setSplitBrainEnabled(boolean splitBrainEnabled) {
+    this.splitBrainEnabled = splitBrainEnabled;
+  }
+
+  public void setMemberWeight(byte memberWeight) {
+    this.memberWeight = memberWeight;
+  }
+
+  public void setInetAddr(InetAddress inetAddr) {
+    this.inetAddr = inetAddr;
+  }
+
+  public void setProcessId(int processId) {
+    this.processId = processId;
+  }
+
+  public void setVmKind(int vmKind) {
+    this.vmKind = vmKind;
+  }
+
+  public void setBirthViewId(int birthViewId) {
+    this.vmViewId = birthViewId;
+  }
+
+  public void setDirectPort(int directPort) {
+    this.directPort = directPort;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public void setDurableClientAttributes(
+      DurableClientAttributes durableClientAttributes) {
+    this.durableClientAttributes = durableClientAttributes;
+  }
+
+  public void setGroups(String[] groups) {
+    this.groups = groups;
+  }
+
+  public void setPort(int p) {
+    this.udpPort = p;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return GMSMEMBER;
+  }
+
+  static final int SB_ENABLED = 0x01;
+  static final int SHOULD_NOT_BE_COORD = 0x02;
+  
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    Version.writeOrdinal(out, this.versionOrdinal, true);
+    
+    int flags = 0;
+    if (splitBrainEnabled) flags |= SB_ENABLED;
+    if (shouldNotBeCoordinator) flags |= SHOULD_NOT_BE_COORD;
+    out.writeInt(flags);
+
+    DataSerializer.writeInetAddress(inetAddr, out);
+    out.writeInt(udpPort);
+    out.writeInt(vmViewId);
+    out.writeInt(directPort);
+    out.writeByte(memberWeight);
+    out.writeInt(processId);
+    out.writeInt(vmKind);
+    DataSerializer.writeString(name,  out);
+    DataSerializer.writeStringArray(groups, out);
+    out.writeLong(uuidLSBs);
+    out.writeLong(uuidMSBs);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.versionOrdinal = Version.readOrdinal(in);
+    
+    int flags = in.readInt();
+    this.splitBrainEnabled = (flags & SB_ENABLED) != 0;
+    this.shouldNotBeCoordinator = (flags & SHOULD_NOT_BE_COORD) != 0;
+    
+    this.inetAddr = DataSerializer.readInetAddress(in);
+    this.udpPort = in.readInt();
+    this.vmViewId = in.readInt();
+    this.directPort = in.readInt();
+    this.memberWeight = in.readByte();
+    this.processId = in.readInt();
+    this.vmKind = in.readInt();
+    this.name = DataSerializer.readString(in);
+    this.groups = DataSerializer.readStringArray(in);
+    this.uuidLSBs = in.readLong();
+    this.uuidMSBs = in.readLong();
+  }
+
+  @Override
+  public void writeAdditionalData(DataOutput out) throws IOException {
+    out.writeLong(uuidLSBs);
+    out.writeLong(uuidMSBs);
+  }
+
+  @Override
+  public void readAdditionalData(DataInput in) throws ClassNotFoundException,
+      IOException {
+    this.uuidLSBs = in.readLong();
+    this.uuidMSBs = in.readLong();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..d07cd2e
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberFactory.java
@@ -0,0 +1,133 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import java.net.InetAddress;
+
+import com.gemstone.gemfire.CancelCriterion;
+import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.SystemConnectException;
+import com.gemstone.gemfire.distributed.internal.DMStats;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionException;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener;
+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.mgr.GMSMembershipManager;
+import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.tcp.ConnectionException;
+
+/**
+ * Create a new Member based on the given inputs.
+ * 
+ * @see com.gemstone.gemfire.distributed.internal.membership.NetMember
+ */
+public class GMSMemberFactory implements MemberServices {
+
+  /**
+   * Return a new NetMember, possibly for a different host
+   * 
+   * @param i the name of the host for the specified NetMember, the current host (hopefully)
+   * if there are any problems.
+   * @param splitBrainEnabled whether the member has this feature enabled
+   * @param canBeCoordinator whether the member can be membership coordinator
+   * @param p the membership port
+   * @param attr the MemberAttributes
+   * @return the new NetMember
+   */
+  public NetMember newNetMember(InetAddress i, int p, boolean splitBrainEnabled,
+      boolean canBeCoordinator, MemberAttributes attr, short version) {
+    GMSMember result = new GMSMember(i, p, splitBrainEnabled, canBeCoordinator, version);
+    result.setAttributes(attr);
+    return result;
+  }
+
+  private MemberAttributes getDefaultAttributes() {
+    // TODO can we get rid of this??
+    if (MemberAttributes.DEFAULT.getVmPid() == -1 ||
+        MemberAttributes.DEFAULT.getVmKind() == -1) {
+      MemberAttributes.setDefaults(
+          -1, 
+          OSProcess.getId(), 
+          -1,
+          DistributionManager.getDistributionManagerType(), 
+          null,
+          null, null);
+    }
+    return MemberAttributes.DEFAULT;
+  }
+  
+  /**
+   * Return a new NetMember representing current host.  This assumes that
+   * the member does not have network partition detection enabled and can
+   * be group coordinator
+   * @param i an InetAddress referring to the current host
+   * @param p the membership port being used
+   * @return the new NetMember
+   */
+  public NetMember newNetMember(InetAddress i, int p) {
+    GMSMember result = new GMSMember(i, p, false, true, Version.CURRENT_ORDINAL);
+    result.setAttributes(getDefaultAttributes());
+    return result;
+  }
+
+  /**
+   * Return a new NetMember representing current host
+   * 
+   * @param s a String referring to the current host
+   * @param p the membership port being used
+   * @return the new member
+   */
+  public NetMember newNetMember(String s, int p) {
+    GMSMember result = new GMSMember(s, p);
+    result.setAttributes(getDefaultAttributes());
+    return result;
+  }
+  
+  /**
+   * Return a new Member
+   * 
+   * Used by externalization only.
+   * 
+   * @return blank member for use with externalization
+   */
+  public NetMember newNetMember() {
+    return new GMSMember();
+  }
+
+  public MembershipManager newMembershipManager(DistributedMembershipListener listener,
+          DistributionConfig config,
+          RemoteTransportConfig transport, DMStats stats) throws DistributionException
+  {
+    Services services = new Services(listener, config, transport, stats);
+    try {
+      services.init();
+      services.start();
+    }
+    catch (ConnectionException e) {
+      throw new DistributionException(LocalizedStrings.JGroupMemberFactory_UNABLE_TO_CREATE_MEMBERSHIP_MANAGER.toLocalizedString(), e);
+    }
+    catch (GemFireConfigException e) {
+      throw e;
+    }
+    catch (SystemConnectException e) {
+      throw e;
+    }
+    catch (RuntimeException e) {
+      Services.getLogger().error("Unexpected problem starting up membership services", e);
+      throw new SystemConnectException("Problem starting up membership services", e);
+    }
+    return (MembershipManager)services.getManager();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..c65f4d0
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSUtil.java
@@ -0,0 +1,97 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
+import com.gemstone.gemfire.internal.SocketCreator;
+
+public class GMSUtil {
+  static Logger logger = Services.getLogger();
+  
+  public static List<InetSocketAddress> parseLocators(String locatorsString, String bindAddress) {
+    InetAddress addr = null;
+    
+    try {
+      if (bindAddress == null || bindAddress.trim().length() == 0) {
+        addr = SocketCreator.getLocalHost();
+        logger.info("Peer-to-peer bind address was null - checking for locator communications using " + addr);
+      } else {
+        addr = InetAddress.getByName(bindAddress);
+      }
+    } catch (UnknownHostException e) {
+      // ignore
+    }
+    return parseLocators(locatorsString, addr);
+  }
+  
+  
+  public static List<InetSocketAddress> parseLocators(String locatorsString, InetAddress bindAddress) {
+    List<InetSocketAddress> result=new ArrayList<InetSocketAddress>(2);
+    String host;
+    int port;
+    boolean checkLoopback = (bindAddress != null);
+    boolean isLoopback = (checkLoopback? bindAddress.isLoopbackAddress() : false);
+
+    StringTokenizer parts=new StringTokenizer(locatorsString, ",");
+    while(parts.hasMoreTokens()) {
+      try {
+        String str = parts.nextToken();
+        host = str.substring(0, str.indexOf('['));
+        int idx = host.lastIndexOf('@');
+        if (idx < 0) {
+          idx = host.lastIndexOf(':');
+        }
+        String start = host.substring(0, idx > -1 ? idx : host.length());
+        if (start.indexOf(':') >= 0) { // a single numeric ipv6 address
+          idx = host.lastIndexOf('@');
+        }
+        if (idx >= 0) {
+          host = host.substring(idx+1, host.length());
+        }
+
+        int startIdx = str.indexOf('[') + 1;
+        int endIdx = str.indexOf(']');
+        port=Integer.parseInt(str.substring(startIdx, endIdx));
+        InetSocketAddress isa = new InetSocketAddress(host, port);
+
+        if (checkLoopback) {
+          if (isLoopback && !isa.getAddress().isLoopbackAddress()) { 
+            throw new GemFireConfigException("This process is attempting to join with a loopback address ("
+               +bindAddress+") using a locator that does not have a local address ("
+               +isa+").  On Unix this usually means that /etc/hosts is misconfigured.");
+          }
+        }
+        result.add(isa);
+      }
+      catch(NumberFormatException e) {
+        // this shouldln't happen because the config has already been parsed and
+        // validated
+      }
+    }
+
+    return result;
+  }
+
+  public static void insertGemFireAttributes(GMSMember addr, MemberAttributes attr) {
+    addr.setProcessId(attr.getVmPid());
+    addr.setVmKind(attr.getVmKind());
+    addr.setDirectPort(attr.getPort());
+    addr.setBirthViewId(attr.getVmViewId());
+    addr.setName(attr.getName());
+    addr.setGroups(attr.getGroups());
+    addr.setDurableClientAttributes(attr.getDurableClientAttributes());
+  }
+
+  public static void insertDefaultGemFireAttributes(GMSMember addr) {
+    MemberAttributes attr = com.gemstone.gemfire.distributed.internal.membership.MemberAttributes.DEFAULT;
+    insertGemFireAttributes(addr, attr);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/ServiceConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/ServiceConfig.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/ServiceConfig.java
new file mode 100755
index 0000000..d6b4d47
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/ServiceConfig.java
@@ -0,0 +1,140 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
+
+public class ServiceConfig {
+  /** various settings from Geode configuration */
+  private int joinTimeout;
+  private long fdTimeout;
+  private int[] membershipPortRange;
+  private int udpRecvBufferSize;
+  private int udpSendBufferSize;
+  private long memberTimeout;
+  private Integer lossThreshold;
+  private Integer memberWeight;
+  private boolean networkPartitionDetectionEnabled;
+  private int locatorWaitTime;
+
+  /** the configuration for the distributed system */
+  private DistributionConfig dconfig;
+  
+  /** the transport config from the distribution manager */
+  private RemoteTransportConfig transport;
+
+
+  public int getLocatorWaitTime() {
+    return locatorWaitTime;
+  }
+
+
+  public int getJoinTimeout() {
+    return joinTimeout;
+  }
+
+
+  public long getFdTimeout() {
+    return fdTimeout;
+  }
+
+
+  public int[] getMembershipPortRange() {
+    return membershipPortRange;
+  }
+
+
+  public int getUdpRecvBufferSize() {
+    return udpRecvBufferSize;
+  }
+
+
+  public int getUdpSendBufferSize() {
+    return udpSendBufferSize;
+  }
+
+
+  public long getMemberTimeout() {
+    return memberTimeout;
+  }
+
+
+  public Integer getLossThreshold() {
+    return lossThreshold;
+  }
+
+
+  public Integer getMemberWeight() {
+    return memberWeight;
+  }
+
+
+  public boolean isNetworkPartitionDetectionEnabled() {
+    return networkPartitionDetectionEnabled;
+  }
+  
+  public void setNetworkPartitionDetectionEnabled(boolean enabled) {
+    this.networkPartitionDetectionEnabled = enabled;
+  }
+  
+  public DistributionConfig getDistributionConfig() {
+    return this.dconfig;
+  }
+
+
+  public RemoteTransportConfig getTransport() {
+    return this.transport;
+  }
+  
+
+  public ServiceConfig(RemoteTransportConfig transport, DistributionConfig theConfig) {
+    this.dconfig = theConfig;
+    this.transport = transport;
+    
+    // see whether the FD protocol or FD_SOCK protocol should be used
+    fdTimeout = Long.getLong("gemfire.FD_TIMEOUT", 0).longValue(); // in 4.1.2 to force use of FD
+    
+    int defaultJoinTimeout = 17000;
+    int defaultNumPings = 1; // number of get_mbrs loops per findInitialMembers
+    if (theConfig.getLocators().length() > 0 && !Locator.hasLocators()) {
+      defaultJoinTimeout = 60000;
+    }
+    joinTimeout = Integer.getInteger("p2p.joinTimeout", defaultJoinTimeout).intValue();
+    
+    // if network partition detection is enabled, we must connect to the locators
+    // more frequently in order to make sure we're not isolated from them
+    if (theConfig.getEnableNetworkPartitionDetection()) {
+      if (!SocketCreator.FORCE_DNS_USE) {
+        SocketCreator.resolve_dns = false;
+      }
+    }
+
+
+    membershipPortRange = theConfig.getMembershipPortRange();
+    
+    udpRecvBufferSize = DistributionConfig.DEFAULT_UDP_RECV_BUFFER_SIZE_REDUCED;
+    udpSendBufferSize = theConfig.getUdpSendBufferSize();
+
+    memberTimeout = (fdTimeout > 0) ? fdTimeout : theConfig.getMemberTimeout();
+
+    // The default view-ack timeout in 7.0 is 12347 ms but is adjusted based on the member-timeout.
+    // We don't want a longer timeout than 12437 because new members will likely time out trying to 
+    // connect because their join timeouts are set to expect a shorter period
+    int ackCollectionTimeout = theConfig.getMemberTimeout() * 2 * 12437 / 10000;
+    if (ackCollectionTimeout < 1500) {
+      ackCollectionTimeout = 1500;
+    } else if (ackCollectionTimeout > 12437) {
+      ackCollectionTimeout = 12437;
+    }
+    ackCollectionTimeout = Integer.getInteger("gemfire.VIEW_ACK_TIMEOUT", ackCollectionTimeout).intValue();
+
+    lossThreshold = Integer.getInteger("gemfire.network-partition-threshold", 51);
+    if (lossThreshold < 51) lossThreshold = 51;
+    if (lossThreshold > 100) lossThreshold = 100;
+    
+    memberWeight = Integer.getInteger("gemfire.member-weight", 0);
+    locatorWaitTime = theConfig.getLocatorWaitTime();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..7b5aec7
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/Services.java
@@ -0,0 +1,233 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+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;
+  
+  
+  public static Logger getLogger() {
+    return logger;
+  }
+  
+  public static ThreadGroup getThreadGroup() {
+    return threadGroup;
+  }
+  
+
+
+  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();
+  }
+  
+  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/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/SuspectMember.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/SuspectMember.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/SuspectMember.java
new file mode 100755
index 0000000..77e196c
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/SuspectMember.java
@@ -0,0 +1,39 @@
+/**
+ */
+package com.gemstone.gemfire.distributed.internal.membership.gms;
+
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+
+/** represents a suspicion raised about a member */
+public class SuspectMember
+{
+  /** the source of suspicion */
+  public InternalDistributedMember whoSuspected;
+  
+  /** suspected member */
+  public InternalDistributedMember suspectedMember;
+  
+  /** create a new SuspectMember */
+  public SuspectMember(InternalDistributedMember whoSuspected, InternalDistributedMember suspectedMember) {
+    this.whoSuspected = whoSuspected;
+    this.suspectedMember = suspectedMember;
+  }
+  
+  @Override
+  public String toString() {
+    return "{source="+whoSuspected+"; suspect="+suspectedMember+"}";
+  }
+  
+  @Override
+  public int hashCode() {
+    return this.suspectedMember.hashCode();
+  }
+  
+  @Override
+  public boolean equals(Object other) {
+    if ( !(other instanceof SuspectMember) ) {
+      return false;
+    }
+    return this.suspectedMember.equals(((SuspectMember)other).suspectedMember);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..c008171
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticator.java
@@ -0,0 +1,84 @@
+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.interfaces.Authenticator;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+
+public class GMSAuthenticator implements Authenticator {
+
+  @Override
+  public void init(Services s) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void start() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void started() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void stop() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void stopped() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void installView(NetView v) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void beSick() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void playDead() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void beHealthy() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public String authenticate(InternalDistributedMember m, Object credentials)
+      throws AuthenticationFailedException {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public Object getCredentials() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void emergencyClose() {
+    // TODO Auto-generated method stub
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..b1f5664
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -0,0 +1,103 @@
+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.interfaces.HealthMonitor;
+
+/** Failure Detection */
+public class GMSHealthMonitor implements HealthMonitor {
+
+  private Services services;
+  private NetView currentView;
+
+  public static void loadEmergencyClasses() {
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.distributed.internal.membership.gms.fd.HealthMonitor#messageReceivedFrom(com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember)
+   */
+  @Override
+  public void contactedBy(InternalDistributedMember sender) {
+    // TODO Auto-generated method stub
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.distributed.internal.membership.gms.fd.HealthMonitor#suspectMember(com.gemstone.gemfire.distributed.DistributedMember, java.lang.String)
+   */
+  @Override
+  public void suspect(InternalDistributedMember mbr, String reason) {
+    // TODO Auto-generated method stub
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.distributed.internal.membership.gms.fd.HealthMonitor#checkSuspect(com.gemstone.gemfire.distributed.DistributedMember, java.lang.String)
+   */
+  @Override
+  public void checkSuspect(DistributedMember mbr, String reason) {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void playDead(boolean b) {
+    // TODO Auto-generated method stub
+    
+  }
+  
+  public void start() {
+  }
+
+  public void installView(NetView newView) {
+    currentView = newView;
+  }
+
+  @Override
+  public void init(Services s) {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void started() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void stop() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void stopped() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void beSick() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void playDead() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void beHealthy() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void emergencyClose() {
+    // TODO Auto-generated method stub
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Authenticator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Authenticator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Authenticator.java
new file mode 100755
index 0000000..fa45ff3
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Authenticator.java
@@ -0,0 +1,11 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+
+public interface Authenticator extends Service {
+
+  String authenticate(InternalDistributedMember m, Object credentials) throws AuthenticationFailedException;
+
+  Object getCredentials();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/HealthMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/HealthMonitor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/HealthMonitor.java
new file mode 100755
index 0000000..6b268cb
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/HealthMonitor.java
@@ -0,0 +1,14 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+
+public interface HealthMonitor extends Service {
+
+  public abstract void contactedBy(InternalDistributedMember sender);
+
+  public abstract void suspect(InternalDistributedMember mbr, String reason);
+
+  public abstract void checkSuspect(DistributedMember mbr, String reason);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/JoinLeave.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/JoinLeave.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/JoinLeave.java
new file mode 100755
index 0000000..d6087bd
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/JoinLeave.java
@@ -0,0 +1,38 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.distributed.internal.membership.NetView;
+
+public interface JoinLeave extends Service {
+
+  /**
+   * joins the distributed system and returns true if successful, false if not.
+   * Throws SystemConnectException and GemFireConfigException
+   */
+  boolean join();
+
+  /**
+   * leaves the distributed system.  Should be invoked before stop()
+   */
+  void leave();
+
+  /**
+   * force another member out of the system
+   */
+  void remove(InternalDistributedMember m, String reason);
+  
+  /**
+   * returns the local address
+   */
+  InternalDistributedMember getMemberID();
+  
+  /**
+   * returns the current membership view
+   */
+  NetView getView();
+
+  /**
+   * test hook
+   */
+  void disableDisconnectOnQuorumLossForTesting();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Locator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Locator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Locator.java
new file mode 100755
index 0000000..0a77bde
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Locator.java
@@ -0,0 +1,16 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import com.gemstone.gemfire.distributed.internal.membership.NetView;
+
+/**
+ * The Locator interface allows member services to interact with the
+ * Locator TcpHandler component of Geode's locator.  The Locator
+ * handler's lifecycle is not controlled by member services.
+ */
+public interface Locator {
+  /**
+   * called when a new view is installed by Membership
+   */
+  void installView(NetView v);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Manager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Manager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Manager.java
new file mode 100755
index 0000000..00ceeed
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Manager.java
@@ -0,0 +1,50 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import java.io.NotSerializableException;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.distributed.internal.membership.NetMember;
+
+/**
+ * Manager presents the GMS services to the outside world and
+ * handles startup/shutdown race conditions.  It is also the
+ * default MessageHandler
+ */
+public interface Manager extends Service, MessageHandler {
+
+  /**
+   * After all services have been started this is used to
+   * join the distributed system
+   */
+  void joinDistributedSystem();
+
+  /**
+   * Sends a message using a selected distribution channel
+   * (e.g. Messenger or DirectChannel)
+   */
+  void send(DistributionMessage m) throws NotSerializableException;
+
+  InternalDistributedMember getMemberID(NetMember m);
+
+  void forceDisconnect(String reason);
+
+  void addSurpriseMemberForTesting(DistributedMember mbr, long birthTime);
+
+  boolean isShunned(DistributedMember mbr);
+
+  DistributedMember getLeadMember();
+
+  DistributedMember getCoordinator();
+  
+  boolean isMulticastAllowed();
+  
+  void setShutdownCause(Exception e);
+  
+  Throwable getShutdownCause();
+  
+  boolean shutdownInProgress();
+  
+  void membershipFailure(String message, Exception cause);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/MessageHandler.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/MessageHandler.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/MessageHandler.java
new file mode 100755
index 0000000..9788f5a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/MessageHandler.java
@@ -0,0 +1,14 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+
+/**
+ * MessageHandler processes a message received by Messenger.
+ * Handlers are registered with Messenger to consume specific
+ * classes of message.
+ */
+public interface MessageHandler {
+  
+  public void processMessage(DistributionMessage m);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Messenger.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Messenger.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Messenger.java
new file mode 100755
index 0000000..2c7e4e1
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Messenger.java
@@ -0,0 +1,25 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.interfaces;
+
+import java.io.IOException;
+import java.util.Set;
+
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+
+public interface Messenger extends Service {
+  /**
+   * adds a handler for the given class/interface of messages
+   */
+  void addHandler(Class c, MessageHandler h);
+
+  /**
+   * sends an asynchronous message.  Returns destinations that did not
+   * receive the message due to no longer being in the view
+   */
+  Set<InternalDistributedMember> send(DistributionMessage m) throws IOException;
+
+  /**
+   * returns the endpoint ID for this member
+   */
+  InternalDistributedMember getMemberID();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/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
new file mode 100755
index 0000000..082ea0a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/interfaces/Service.java
@@ -0,0 +1,58 @@
+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;
+
+/**
+ * Services in GMS all implement this interface
+ *
+ */
+public interface Service {
+  void init(Services s);
+
+  /**
+   * called after all services have been initialized 
+   * with init() and all services are available via Services
+   */
+  void start();
+
+  /**
+   * called after all servers have been started
+   */
+  void started();
+
+  /**
+   * called when the GMS is stopping
+   */
+  void stop();
+
+  /**
+   * called after all services have been stopped
+   */
+  void stopped();
+
+  /**
+   * called when a new view is installed by Membership
+   */
+  void installView(NetView v);
+
+  /**
+   * test method for simulating a sick/dead member
+   */
+  void beSick();
+  
+  /**
+   * test method for simulating a sick/dead member
+   */
+  void playDead();
+  
+  /**
+   * test method for simulating a sick/dead member
+   */
+  void beHealthy();
+  
+  /**
+   * shut down threads, cancel timers, etc.
+   */
+  void emergencyClose();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorRequest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorRequest.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorRequest.java
new file mode 100755
index 0000000..42d2006
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorRequest.java
@@ -0,0 +1,54 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.locator;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+public class FindCoordinatorRequest implements DataSerializableFixedID, PeerLocatorRequest {
+
+  public InternalDistributedMember memberID;
+  
+  public FindCoordinatorRequest(InternalDistributedMember myId) {
+    this.memberID = myId;
+  }
+  
+  public FindCoordinatorRequest() {
+    // no-arg constructor for serialization
+  }
+
+  public InternalDistributedMember getMemberID() {
+    return memberID;
+  }
+  
+  @Override
+  public String toString() {
+    return "FindCoordinatorRequest(memberID="+memberID+")";
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return FIND_COORDINATOR_REQ;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(this.memberID, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.memberID = DataSerializer.readObject(in);
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d2a942e8/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorResponse.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorResponse.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorResponse.java
new file mode 100755
index 0000000..7ac25db
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/FindCoordinatorResponse.java
@@ -0,0 +1,72 @@
+package com.gemstone.gemfire.distributed.internal.membership.gms.locator;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+public class FindCoordinatorResponse implements DataSerializableFixedID {
+  private InternalDistributedMember coordinator;
+  private boolean networkPartitionDetectionEnabled;
+  private boolean usePreferredCoordinators;
+  
+  
+  public FindCoordinatorResponse(InternalDistributedMember coordinator,
+      boolean networkPartitionDectionEnabled, boolean usePreferredCoordinators) {
+    this.coordinator = coordinator;
+    this.networkPartitionDetectionEnabled = networkPartitionDectionEnabled;
+    this.usePreferredCoordinators = usePreferredCoordinators;
+  }
+  
+  public FindCoordinatorResponse() {
+    // no-arg constructor for serialization
+  }
+
+  public boolean isNetworkPartitionDetectionEnabled() {
+    return networkPartitionDetectionEnabled;
+  }
+
+  public boolean isUsePreferredCoordinators() {
+    return usePreferredCoordinators;
+  }
+
+  public InternalDistributedMember getCoordinator() {
+    return coordinator;
+  }
+  
+  @Override
+  public String toString() {
+    return "FindCoordinatorResponse(coordinator="+coordinator+")";
+  }
+
+
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return FIND_COORDINATOR_RESP;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(coordinator, out);
+    out.writeBoolean(networkPartitionDetectionEnabled);
+    out.writeBoolean(usePreferredCoordinators);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    coordinator = DataSerializer.readObject(in);
+    networkPartitionDetectionEnabled = in.readBoolean();
+    usePreferredCoordinators = in.readBoolean();
+  }
+
+}


Mime
View raw message