removed BridgeMembership* and UniversalMembershipListenerAdapter

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

Branch: refs/heads/feature/GEODE-243
Commit: 1e5fc5b4ac93540d6d5f86a2cc7fcac207670040
Parents: 51bddd7
Author: Darrel Schneider <dschnei...@pivotal.io>
Authored: Mon Aug 31 15:55:48 2015 -0700
Committer: Darrel Schneider <dschnei...@pivotal.io>
Committed: Mon Aug 31 15:55:48 2015 -0700

----------------------------------------------------------------------
 .../gemfire/admin/GemFireMemberStatus.java      |    8 +-
 .../client/internal/EndpointManagerImpl.java    |    8 +-
 .../gemfire/cache/util/BridgeMembership.java    |   55 -
 .../cache/util/BridgeMembershipEvent.java       |   23 -
 .../cache/util/BridgeMembershipListener.java    |   41 -
 .../util/BridgeMembershipListenerAdapter.java   |   43 -
 .../UniversalMembershipListenerAdapter.java     |  352 ----
 .../internal/cache/AbstractCacheServer.java     |   58 +-
 .../gemfire/internal/cache/CacheServerImpl.java |   14 +-
 .../cache/tier/InternalBridgeMembership.java    |  715 --------
 .../cache/tier/InternalClientMembership.java    |  617 +++++++
 .../cache/tier/sockets/ServerConnection.java    |    8 +-
 .../internal/beans/CacheServerBridge.java       |   14 +-
 .../internal/beans/ManagementAdapter.java       |   42 +-
 .../functions/GetMemberInformationFunction.java |    4 +-
 .../management/membership/ClientMembership.java |    8 +-
 .../internal/AutoConnectionSourceDUnitTest.java |   21 +-
 .../cache30/BridgeMembershipDUnitTest.java      | 1660 ------------------
 .../BridgeMembershipSelectorDUnitTest.java      |    2 +-
 .../cache30/ClientMembershipDUnitTest.java      | 1660 ++++++++++++++++++
 ...ersalMembershipListenerAdapterDUnitTest.java |   16 +-
 .../test/java/dunit/DistributedTestCase.java    |    4 +-
 22 files changed, 2369 insertions(+), 3004 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/admin/GemFireMemberStatus.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/admin/GemFireMemberStatus.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/admin/GemFireMemberStatus.java
index 08cb0e7..e63cff5 100755
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/admin/GemFireMemberStatus.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/admin/GemFireMemberStatus.java
@@ -37,7 +37,7 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionStatus;
 import com.gemstone.gemfire.internal.cache.RegionStatus;
-import com.gemstone.gemfire.internal.cache.tier.InternalBridgeMembership;
+import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
 import 
com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
 
 /**
@@ -539,7 +539,7 @@ public class GemFireMemberStatus implements Serializable {
       // The following method returns a map of client member id to a cache
       // client info. For now, keep track of the member ids in the set of
       // _connectedClients.
-      Map allConnectedClients = 
InternalBridgeMembership.getStatusForAllClientsIgnoreSubscriptionStatus();
+      Map allConnectedClients = 
InternalClientMembership.getStatusForAllClientsIgnoreSubscriptionStatus();
       Iterator allConnectedClientsIterator = 
allConnectedClients.values().iterator();
       while (allConnectedClientsIterator.hasNext()) {
         CacheClientStatus ccs = (CacheClientStatus) 
allConnectedClientsIterator.next();
@@ -549,7 +549,7 @@ public class GemFireMemberStatus implements Serializable {
       }
 
       // Get client queue sizes
-      Map clientQueueSize = 
getClientIDMap(InternalBridgeMembership.getClientQueueSizes());
+      Map clientQueueSize = 
getClientIDMap(InternalClientMembership.getClientQueueSizes());
       setClientQueueSizes(clientQueueSize);
       
       // Set server acceptor port (set it based on the first CacheServer)
@@ -603,7 +603,7 @@ public class GemFireMemberStatus implements Serializable {
       // the logical connections for that server will be 0. For now, keep track
       // of the keys (server names) of this map in the sets of 
_connectedServers
       // and _unconnectedServers.
-      Map connectedServers = InternalBridgeMembership.getConnectedServers();
+      Map connectedServers = InternalClientMembership.getConnectedServers();
       if (!connectedServers.isEmpty()) {
         Iterator connected = connectedServers.entrySet().iterator();
         while (connected.hasNext()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/EndpointManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/EndpointManagerImpl.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/EndpointManagerImpl.java
index 5bf3a48..e4741de 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/EndpointManagerImpl.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/EndpointManagerImpl.java
@@ -26,7 +26,7 @@ import 
com.gemstone.gemfire.distributed.internal.ServerLocation;
 import com.gemstone.gemfire.internal.DummyStatisticsFactory;
 import com.gemstone.gemfire.internal.cache.PoolStats;
 import com.gemstone.gemfire.internal.cache.execute.TransactionFunctionService;
-import com.gemstone.gemfire.internal.cache.tier.InternalBridgeMembership;
+import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
 import com.gemstone.gemfire.internal.logging.LogService;
 
 /**
@@ -274,7 +274,7 @@ public class EndpointManagerImpl implements EndpointManager 
{
         return;
       }
       //logger.warn("EMANFIRE:CRASH:"+endpoint.getLocation());
-      InternalBridgeMembership.notifyCrashed(endpoint.getMemberId(), false);
+      InternalClientMembership.notifyCrashed(endpoint.getMemberId(), false);
     }
 
     public void endpointNoLongerInUse(Endpoint endpoint) {
@@ -282,7 +282,7 @@ public class EndpointManagerImpl implements EndpointManager 
{
         return;
       }
       //logger.warn("EMANFIRE:LEFT:"+endpoint.getLocation());
-      InternalBridgeMembership.notifyLeft(endpoint.getMemberId(), false);
+      InternalClientMembership.notifyLeft(endpoint.getMemberId(), false);
     }
 
     public void endpointNowInUse(Endpoint endpoint) {
@@ -290,7 +290,7 @@ public class EndpointManagerImpl implements EndpointManager 
{
         return;
       }
       //logger.warn("EMANFIRE:JOIN:"+endpoint.getLocation()+" 
mid:"+endpoint.getMemberId(),new Exception());
-      InternalBridgeMembership.notifyJoined(endpoint.getMemberId(), false);
+      InternalClientMembership.notifyJoined(endpoint.getMemberId(), false);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembership.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembership.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembership.java
deleted file mode 100755
index fdb718d..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembership.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.cache.util;
-
-import com.gemstone.gemfire.internal.cache.tier.InternalBridgeMembership;
-
-/**
- * Provides utility methods for registering and unregistering
- * BridgeMembershipListeners in this process.
- *
- * @author Kirk Lund
- * @since 4.2.1
- * @deprecated see com.gemstone.gemfire.management.membership.ClientMembership
- */
-public final class BridgeMembership {
-
-  private BridgeMembership() {}
-
-  /**
-   * Registers a {@link BridgeMembershipListener} for notification of
-   * connection changes for BridgeServers and bridge clients.
-   * @param listener a BridgeMembershipListener to be registered
-   */
-  public static void registerBridgeMembershipListener(BridgeMembershipListener 
listener) {
-    InternalBridgeMembership.registerBridgeMembershipListener(listener);
-  }
-
-  /**
-   * Removes registration of a previously registered {@link
-   * BridgeMembershipListener}.
-   * @param listener a BridgeMembershipListener to be unregistered
-   */
-  public static void 
unregisterBridgeMembershipListener(BridgeMembershipListener listener) {
-    InternalBridgeMembership.unregisterBridgeMembershipListener(listener);
-  }
-
-  /**
-   * Returns an array of all the currently registered
-   * <code>BridgeMembershipListener</code>s. Modifications to the returned
-   * array will not effect the registration of these listeners.
-   * @return the registered <code>BridgeMembershipListener</code>s; an empty
-   * array if no listeners
-   */
-  public static BridgeMembershipListener[] getBridgeMembershipListeners() {
-    return InternalBridgeMembership.getBridgeMembershipListeners();
-  }
-
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipEvent.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipEvent.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipEvent.java
deleted file mode 100755
index b9d205e..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.cache.util;
-
-import com.gemstone.gemfire.management.membership.ClientMembershipEvent;
-
-/**
- * An event delivered to a {@link BridgeMembershipListener} when this 
- * process detects connection changes to BridgeServers or bridge clients.
- *
- * @author Kirk Lund
- * @since 4.2.1
- * @deprecated see 
com.gemstone.gemfire.management.membership.ClientMembershipEvent
- */
-public interface BridgeMembershipEvent extends ClientMembershipEvent {
-  
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListener.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListener.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListener.java
deleted file mode 100755
index d0e6196..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
- package com.gemstone.gemfire.cache.util;
-
-/**
- * A listener whose callback methods are invoked when this process 
- * detects connection changes to BridgeServers or bridge clients.
- *
- * @see BridgeMembership#registerBridgeMembershipListener
- *
- * @author Kirk Lund
- * @since 4.2.1
- * @deprecated see 
com.gemstone.gemfire.management.membership.ClientMembershipListener
- */
-public interface BridgeMembershipListener{
-
-  /**
-   * Invoked when a client has connected to this process or when this
-   * process has connected to a BridgeServer.
-   */
-  public void memberJoined(BridgeMembershipEvent event);
-
-  /**
-   * Invoked when a client has gracefully disconnected from this process
-   * or when this process has gracefully disconnected from a BridgeServer.
-   */
-  public void memberLeft(BridgeMembershipEvent event);
-
-  /**
-   * Invoked when a client has unexpectedly disconnected from this process
-   * or when this process has unexpectedly disconnected from a BridgeServer.
-   */
-  public void memberCrashed(BridgeMembershipEvent event);
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListenerAdapter.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListenerAdapter.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListenerAdapter.java
deleted file mode 100755
index 3ce2721..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/BridgeMembershipListenerAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-
-package com.gemstone.gemfire.cache.util;
-
-/**
- * Utility class that implements all methods in 
- * <code>BridgeMembershipListener</code> with empty implementations.
- * Applications can subclass this class and only override the methods for
- * the events of interest.
- *
- * @author Kirk Lund
- * @since 4.2.1
- * @deprecated see 
com.gemstone.gemfire.management.membership.ClientMembershipListenerAdapter
- */
-public abstract class BridgeMembershipListenerAdapter 
-implements BridgeMembershipListener {
-    
-  /**
-   * Invoked when a client has connected to this process or when this
-   * process has connected to a BridgeServer.
-   */
-  public void memberJoined(BridgeMembershipEvent event) {}
-
-  /**
-   * Invoked when a client has gracefully disconnected from this process
-   * or when this process has gracefully disconnected from a BridgeServer.
-   */
-  public void memberLeft(BridgeMembershipEvent event) {}
-
-  /**
-   * Invoked when a client has unexpectedly disconnected from this process
-   * or when this process has unexpectedly disconnected from a BridgeServer.
-   */
-   public void memberCrashed(BridgeMembershipEvent event) {}
-  
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/UniversalMembershipListenerAdapter.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/UniversalMembershipListenerAdapter.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/UniversalMembershipListenerAdapter.java
deleted file mode 100755
index 840ae09..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/UniversalMembershipListenerAdapter.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-
-package com.gemstone.gemfire.cache.util;
-
-import com.gemstone.gemfire.admin.AdminDistributedSystem;
-import com.gemstone.gemfire.admin.SystemMembershipEvent;
-import com.gemstone.gemfire.admin.SystemMembershipListener;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-
-import java.util.*;
-
-/**
- * <p>The <code>UniversalMembershipListenerAdapter</code> is a wrapper 
- * for {@link com.gemstone.gemfire.admin.SystemMembershipListener} and 
- * {@link BridgeMembershipListener}, providing a facade that makes both
- * appear to customer code as a single <code>SystemMembershipListener</code>
- * from the Admin API. This includes adapting 
- * <code>BridgeMembershipListener</code> events to appear as events for the 
- * <code>SystemMembershipListener</code>.</p>
- *
- * <p><code>UniversalMembershipListenerAdapter</code> implements
- * <code>SystemMembershipListener</code>, exposing the callbacks in that
- * interface as methods to be overridden by the customer.</p>
- *
- * <p>An internal implementation of <code>BridgeMembershipListener</code> is 
- * registered when this class is instantiated. This implementation creates a
- * {@link com.gemstone.gemfire.admin.SystemMembershipEvent} and calls the
- * corresponding <code>SystemMembershipListener</code> public methods on 
- * <code>UniversalMembershipListenerAdapter</code>. To the customer code, the
- * <code>BridgeMembershipEvent</code>s are wrapped to appear as 
- * <code>SystemMembershipEvent</code>s. In this way, both types of membership
- * events appear as <code>SystemMembershipEvent</code>s, allowing customer
- * code written using the Admin API to continue working by changing the
- * listener implementation to simply extend this class.</p>
- *
- * <p>Any BridgeServer using the 
<code>UniversalMembershipListenerAdapter</code>
- * will receive notifications of system membership changes and bridge
- * membership changes through a single listener.</p>
- *
- * <p>Any bridge client using the 
<code>UniversalMembershipListenerAdapter</code>
- * would receive notifications of bridge server connection changes. If that
- * bridge client also creates a connection to the GemFire {@link 
- * com.gemstone.gemfire.distributed.DistributedSystem}, then it will also
- * receive notifications of system membership changes.</p>
- *
- * <p>Subclasses of <code>UniversalMembershipListenerAdapter</code> may be
- * registered as a <code>SystemMembershipListener</code> using {@link 
- * com.gemstone.gemfire.admin.AdminDistributedSystem#addMembershipListener}.
- * It is best, however, to register the listener using {@link
- * #registerMembershipListener} since this allows the adapter to prevent
- * duplicate events for members that are both a system member and a bridge
- * member.</p>
- *
- * <p>Simply constructing the <code>UniversalMembershipListenerAdapter</code>
- * results in the underlying <code>BridgeMembershipListener</code> also being
- * registered.</p>
- *
- * <p>The following code illustrates how a BridgeServer application would use
- * <code>UniversalMembershipListenerAdapter</code>. The code in this example
- * assumes that the class MyMembershipListenerImpl extends 
- * <code>UniversalMembershipListenerAdapter</code>:
- * <pre><code>
- * public class MyMembershipListenerImpl extends 
UniversalMembershipListenerAdapter {
- *   public void memberCrashed(SystemMembershipEvent event) {
- *     // customer code
- *   }
- *   public void memberLeft(SystemMembershipEvent event) {
- *     // customer code
- *   }
- *   public void memberJoined(SystemMembershipEvent event) {
- *     // customer code
- *   }
- * }
- *
- * DistributedSystemConfig config = 
- *   AdminDistributedSystemFactory.defineDistributedSystem(myDS, null);
- * AdminDistributedSystem adminDS = 
- *   AdminDistributedSystemFactory.getDistributedSystem(config);
- * adminDS.connect();
- * MyMembershipListenerImpl myListener = new MyMembershipListenerImpl();
- * myListener.registerMembershipListener(adminDS);
- * </code></pre>
- * The callbacks on MyMembershipListenerImpl would then be
- * invoked for all <code>SystemMembershipEvent</code>s and 
- * <code>BridgeMembershipEvent</code>s. The latter will appear to be 
- * <code>SystemMembershipEvent</code>s.</p>
- *
- * <p>Similarly, the following code illustrates how a bridge client application
- * would use <code>UniversalMembershipListenerAdapter</code>, where 
- * MyMembershipListenerImpl is a subclass. Simply by constructing this subclass
- * of <code>UniversalMembershipListenerAdapter</code> it is registering itself
- * as a <code>BridgeMembershipListener</code>:
- * <pre><code>
- * new MyMembershipListenerImpl();
- * </code></pre>
- * A bridge client that also connects to the <code>DistributedSystem</code>
- * could register with the<code>AdminDistributedSystem</code> as shown 
- * above.</p>
- *
- * <p>It is recommended that subclasses register with the 
- * <code>AdminDistributedSystem</code> using {@link 
- * #registerMembershipListener}, as this will prevent duplicate events for
- * members that are both bridge members and system members. If duplicate
- * events are acceptable, you may register subclasses using {@link 
- * com.gemstone.gemfire.admin.AdminDistributedSystem#addMembershipListener 
- * AdminDistributedSystem#addMembershipListener}.</p>
- *
- * @author Kirk Lund
- * @since 4.2.1
- * @deprecated Use 
com.gemstone.gemfire.management.membership.UniversalMembershipListenerAdapter 
instead.
- */
-public abstract class UniversalMembershipListenerAdapter 
-implements SystemMembershipListener {
-  
-  /** 
-   * Default number of historical events to track in order to avoid duplicate
-   * events for members that are both bridge members and system members;
-   * value is 100.
-   */
-  public static final int DEFAULT_HISTORY_SIZE = 100;
-  
-//  private final Object[] eventHistory;
-//  private final boolean[] eventJoined;
-//  private boolean registered = false;
-  
-  protected final int historySize;
-  protected final LinkedList<String> eventHistory; // list of String memberIds
-  protected final Map<String,Boolean> eventJoined; // key: memberId, value: 
Boolean
-  
-  // TODO: perhaps ctor should require AdminDistributedSystem as arg?
-  
-  /** Constructs an instance of UniversalMembershipListenerAdapter. */
-  public UniversalMembershipListenerAdapter() {
-    this(DEFAULT_HISTORY_SIZE);
-  }
-  
-  /** 
-   * Constructs an instance of UniversalMembershipListenerAdapter.
-   * @param historySize number of historical events to track in order to avoid
-   * duplicate events for members that are both bridge members and system
-   * members; must a number between 10 and <code>Integer.MAX_INT</code>
-   * @throws IllegalArgumentException if historySizde is less than 10
-   */
-  public UniversalMembershipListenerAdapter(int historySize) {
-    if (historySize < 10) {
-      throw new 
IllegalArgumentException(LocalizedStrings.UniversalMembershipListenerAdapter_ARGUMENT_HISTORYSIZE_MUST_BE_BETWEEN_10_AND_INTEGERMAX_INT_0.toLocalizedString(Integer.valueOf(historySize)));
-    }
-    this.historySize = historySize;
-    this.eventHistory = new LinkedList<String>();
-    this.eventJoined = new HashMap<String,Boolean>();
-    
BridgeMembership.registerBridgeMembershipListener(this.bridgeMembershipListener);
-  }
-  
-  /**
-   * Registers this adapter with the <code>AdminDistributedSystem</code>. 
-   * Registering in this way allows the adapter to ensure that callbacks will
-   * not be invoked twice for members that have a bridge connection and a
-   * system connection. If you register with {@link
-   * com.gemstone.gemfire.admin.AdminDistributedSystem#addMembershipListener}
-   * then duplicate events may occur for members that are both bridge members
-   * and system.
-   */
-  public void registerMembershipListener(AdminDistributedSystem admin) {
-    synchronized (this.eventHistory) {
-//      this.registered = true;
-      admin.addMembershipListener(this.systemMembershipListener);
-    }
-  }
-
-  /**
-   * Unregisters this adapter with the <code>AdminDistributedSystem</code>. 
-   * If registration is performed with {@link #registerMembershipListener}
-   * then this method must be used to successfuly unregister the adapter.
-   */
-  public void unregisterMembershipListener(AdminDistributedSystem admin) {
-    synchronized (this.eventHistory) {
-//      this.registered = false;
-      admin.removeMembershipListener(this.systemMembershipListener);
-    }
-    unregisterBridgeMembershipListener();
-  }
-  
-  /**
-   * Registers this adapter as a <code>BridgeMembershipListener</code>.
-   * Registration is automatic when constructing this adapter, so this call
-   * is no necessary unless it was previously unregistered by calling
-   * {@link #unregisterBridgeMembershipListener}.
-   */
-  public void registerBridgeMembershipListener() {
-    
BridgeMembership.registerBridgeMembershipListener(this.bridgeMembershipListener);
-  }
-  
-  /**
-   * Unregisters this adapter as a <code>BridgeMembershipListener</code>.
-   * @see #registerBridgeMembershipListener
-   */
-  public void unregisterBridgeMembershipListener() {
-    
BridgeMembership.unregisterBridgeMembershipListener(this.bridgeMembershipListener);
-  }
-  
-  /**
-   * Invoked when a member has joined the distributed system. Also invoked when
-   * a client has connected to this process or when this process has connected
-   * to a <code>BridgeServer</code>.
-   */
-  public void memberJoined(SystemMembershipEvent event) {}
-
-  /**
-   * Invoked when a member has gracefully left the distributed system. Also
-   * invoked when a client has gracefully disconnected from this process.
-   * or when this process has gracefully disconnected from a 
-   * <code>BridgeServer</code>.   */
-  public void memberLeft(SystemMembershipEvent event) {}
-
-  /**
-   * Invoked when a member has unexpectedly left the distributed system. Also
-   * invoked when a client has unexpectedly disconnected from this process
-   * or when this process has unexpectedly disconnected from a 
-   * <code>BridgeServer</code>.
-   */
-  public void memberCrashed(SystemMembershipEvent event) {}
-  
-  /** Adapts BridgeMembershipEvent to look like a SystemMembershipEvent */
-  public static class AdaptedMembershipEvent implements SystemMembershipEvent {
-    private final BridgeMembershipEvent event;
-
-    protected AdaptedMembershipEvent(BridgeMembershipEvent event) {
-      this.event = event;
-    }
-    /**
-     * Returns true if the member is a bridge client to a BridgeServer hosted
-     * by this process. Returns false if the member is a BridgeServer that this
-     * process is connected to.
-     */
-    public boolean isClient() {
-      return event.isClient();
-    }
-
-    public String getMemberId() {
-      return event.getMemberId();
-    }
-    
-    public DistributedMember getDistributedMember() {
-      return event.getMember();
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-      if (other == this) return true;
-      if (other == null) return false;
-      if (!(other instanceof AdaptedMembershipEvent)) return  false;
-      final AdaptedMembershipEvent that = (AdaptedMembershipEvent) other;
-  
-      if (this.event != that.event &&
-          !(this.event != null &&
-          this.event.equals(that.event))) return false;
-  
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return this.event.hashCode();
-    }
-
-    @Override
-    public String toString() {
-      final StringBuffer sb = new StringBuffer("[AdaptedMembershipEvent: ");
-      sb.append(this.event);
-      sb.append("]");
-      return sb.toString();
-    }
-  }
-
-  private final BridgeMembershipListener bridgeMembershipListener =
-  new BridgeMembershipListener() {
-    public void memberJoined(BridgeMembershipEvent event) {
-      systemMembershipListener.memberJoined(new AdaptedMembershipEvent(event));
-    }
-    public void memberLeft(BridgeMembershipEvent event) {
-      systemMembershipListener.memberLeft(new AdaptedMembershipEvent(event));
-    }
-    public void memberCrashed(BridgeMembershipEvent event) {
-      systemMembershipListener.memberCrashed(new 
AdaptedMembershipEvent(event));
-    }
-  };
-  
-  protected final SystemMembershipListener systemMembershipListener =
-  new SystemMembershipListener() {
-    public void memberJoined(SystemMembershipEvent event) {
-      if (!isDuplicate(event, true)) {
-        UniversalMembershipListenerAdapter.this.memberJoined(event);
-      }
-    }
-    public void memberLeft(SystemMembershipEvent event) {
-      if (!isDuplicate(event, false)) {
-        UniversalMembershipListenerAdapter.this.memberLeft(event);
-      }
-    }
-    public void memberCrashed(SystemMembershipEvent event) {
-      if (!isDuplicate(event, false)) {
-        UniversalMembershipListenerAdapter.this.memberCrashed(event);
-      }
-    }
-    protected boolean isDuplicate(SystemMembershipEvent event, boolean joined) 
{
-      synchronized (eventHistory) {
-        boolean duplicate = false;
-        String memberId = event.getMemberId();
-        
-        // find memberId in eventHistory...
-        int indexOf = eventHistory.indexOf(memberId);
-        if (indexOf > -1) {
-          // found an event for this member
-          if ((eventJoined.get(memberId)).booleanValue() == joined) {
-            // we already recorded a matching event for this member
-            duplicate = true;
-          }
-          else {
-            // remove the event from history and map... will be re-inserted
-            Assert.assertTrue(eventHistory.remove(memberId),
-              "Failed to replace entry in eventHistory for " + memberId);
-            Assert.assertTrue(eventJoined.remove(memberId) != null,
-              "Failed to replace entry in eventJoined for " + memberId);
-          }
-        }
-        
-        if (!duplicate) {
-          // add the event to the history and map
-          if (eventHistory.size() == historySize) {
-            // filled the eventHistory, so need to remove first entry
-            eventHistory.removeFirst();
-          }
-          eventHistory.addLast(memberId); // linked list
-          eventJoined.put(memberId, Boolean.valueOf(joined)); // boolean map
-          Assert.assertTrue(eventHistory.size() <= historySize,
-            "Attempted to grow eventHistory beyond maximum of " + historySize);
-        }
-        return duplicate;
-      } // sync
-    }
-  };
-  
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
index 855009d..42b6bcd 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
@@ -12,15 +12,14 @@ import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
 import com.gemstone.gemfire.cache.server.ServerLoadProbe;
-import com.gemstone.gemfire.cache.util.BridgeMembership;
-import com.gemstone.gemfire.cache.util.BridgeMembershipEvent;
-import com.gemstone.gemfire.cache.util.BridgeMembershipListener;
-import com.gemstone.gemfire.cache.util.BridgeMembershipListenerAdapter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.DM;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.admin.ClientMembershipMessage;
 import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.management.membership.ClientMembership;
+import com.gemstone.gemfire.management.membership.ClientMembershipEvent;
+import com.gemstone.gemfire.management.membership.ClientMembershipListener;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -106,10 +105,10 @@ public abstract class AbstractCacheServer implements 
CacheServer {
   protected ClientSubscriptionConfig clientSubscriptionConfig;
   
   /**
-   * Listener that would listen to bridge membership and notify the admin 
-   * members(if any exist) as clients of this server leave/crash. 
+   * Listens to client membership events and notifies any admin 
+   * members as clients of this server leave/crash. 
    */
-  protected final BridgeMembershipListener listener;
+  protected final ClientMembershipListener listener;
 
   /**
    * The number of seconds to keep transaction states for disconnected clients.
@@ -154,66 +153,41 @@ public abstract class AbstractCacheServer implements 
CacheServer {
       this.listener = null;
       return;
     }
-    listener = new BridgeMembershipListenerAdapter() {
-      /**
-       * Invoked when a client connected to this process or when this process 
-       * has got connected with a BridgeServer.
-       * 
-       * @param event
-       *          BridgeMembershipEvent associated with client getting 
connected
-       */
+    listener = new ClientMembershipListener() {
+
       @Override
-      public void memberJoined(BridgeMembershipEvent event) {
-        /* process events for clients only */
+      public void memberJoined(ClientMembershipEvent event) {
         if (event.isClient()) {
           createAndSendMessage(event, ClientMembershipMessage.JOINED);
         }
       }
-      
-      /**
-       * Invoked when a client has gracefully disconnected from this process
-       * or when this process has gracefully disconnected from a BridgeServer.
-       * 
-       * @param event
-       *          BridgeMembershipEvent associated with client leaving 
gracefully
-       */
+
       @Override
-      public void memberLeft(BridgeMembershipEvent event) {
-        /* process events for clients only */
+      public void memberLeft(ClientMembershipEvent event) {
         if (event.isClient()) {
           createAndSendMessage(event, ClientMembershipMessage.LEFT);
         }
       }
 
-      /**
-       * Invoked when a client has unexpectedly disconnected from this process
-       * or when this process has unexpectedly disconnected from a 
BridgeServer.
-       * 
-       * @param event
-       *          BridgeMembershipEvent associated with client getting
-       *          disconnected unexpectedly
-       */
       @Override
-      public void memberCrashed(BridgeMembershipEvent event) {
-        /* process events for clients only */
+      public void memberCrashed(ClientMembershipEvent event) {
         if (event.isClient()) {
           createAndSendMessage(event, ClientMembershipMessage.CRASHED);
         }
       }
-
+      
       /**
        * Method to create & send the ClientMembershipMessage to admin members.
        * The message is sent only if there are any admin members in the
        * distribution system.
        * 
        * @param event
-       *          BridgeMembershipEvent associated for a change in client
-       *          membership
+       *          describes a change in client membership
        * @param type
        *          type of event - one of ClientMembershipMessage.JOINED,
        *          ClientMembershipMessage.LEFT, ClientMembershipMessage.CRASHED
        */
-      private void createAndSendMessage(BridgeMembershipEvent event, int type) 
{
+      private void createAndSendMessage(ClientMembershipEvent event, int type) 
{
         InternalDistributedSystem ds = null;
         Cache cacheInstance = AbstractCacheServer.this.cache;
         if (cacheInstance != null && !(cacheInstance instanceof 
CacheCreation)) {
@@ -243,7 +217,7 @@ public abstract class AbstractCacheServer implements 
CacheServer {
       }
     };
 
-    BridgeMembership.registerBridgeMembershipListener(listener);
+    ClientMembership.registerClientMembershipListener(listener);
   }
 
   /////////////////////  Instance Methods  /////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerImpl.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerImpl.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerImpl.java
index 4591831..7c8713d 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerImpl.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerImpl.java
@@ -41,8 +41,6 @@ import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
 import com.gemstone.gemfire.cache.server.ServerLoadProbe;
 import com.gemstone.gemfire.cache.server.internal.LoadMonitor;
-import com.gemstone.gemfire.cache.util.BridgeMembership;
-import com.gemstone.gemfire.cache.util.BridgeMembershipListener;
 import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.DM;
@@ -65,6 +63,8 @@ import 
com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.management.membership.ClientMembership;
+import com.gemstone.gemfire.management.membership.ClientMembershipListener;
 
 /**
  * An implementation of the <code>CacheServer</code> interface that delegates
@@ -353,11 +353,11 @@ public class CacheServerImpl
      * won't be registered as would the case when start() is invoked for the 
      * first time.  
      */
-    BridgeMembershipListener[] membershipListeners = 
-                                
BridgeMembership.getBridgeMembershipListeners();
+    ClientMembershipListener[] membershipListeners = 
+                                
ClientMembership.getClientMembershipListeners();
     
     boolean membershipListenerRegistered = false;
-    for (BridgeMembershipListener membershipListener : membershipListeners) {
+    for (ClientMembershipListener membershipListener : membershipListeners) {
       //just checking by reference as the listener instance is final
       if (listener == membershipListener) {
         membershipListenerRegistered = true;
@@ -366,7 +366,7 @@ public class CacheServerImpl
     }
     
     if (!membershipListenerRegistered) {
-      BridgeMembership.registerBridgeMembershipListener(listener);
+      ClientMembership.registerClientMembershipListener(listener);
     }
     
     if (!isGatewayReceiver) {
@@ -460,7 +460,7 @@ public class CacheServerImpl
     // cache.removeBridgeServer(this);
 
     /* Assuming start won't be called after stop */
-    BridgeMembership.unregisterBridgeMembershipListener(this.listener);
+    ClientMembership.unregisterClientMembershipListener(listener);
     
     TXManagerImpl txMgr = (TXManagerImpl) cache.getCacheTransactionManager();
     txMgr.removeHostedTXStatesForClients();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1e5fc5b4/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalBridgeMembership.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalBridgeMembership.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalBridgeMembership.java
deleted file mode 100755
index d6515b9..0000000
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalBridgeMembership.java
+++ /dev/null
@@ -1,715 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-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
- * more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.internal.cache.tier;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.CancelException;
-import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.cache.util.BridgeMembershipEvent;
-import com.gemstone.gemfire.cache.util.BridgeMembershipListener;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl;
-import com.gemstone.gemfire.internal.cache.tier.sockets.ClientHealthMonitor;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.management.membership.ClientMembershipEvent;
-import com.gemstone.gemfire.management.membership.ClientMembershipListener;
-
-/**
- * Handles registration and event notification duties for
- * <code>BridgeMembershipListener</code>s. The public counterpart for this
- * class is {@link com.gemstone.gemfire.cache.util.BridgeMembership}.
- *
- * @author Kirk Lund
- * @since 4.2.1
- */
-public final class InternalBridgeMembership  {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  /** 
-   * The membership listeners registered on this InternalBridgeMembership
-   * 
-   * This list is never modified in place, and a new list is installed
-   * only under the control of (@link #membershipLock}.
-   */
-  private static volatile List<BridgeMembershipListener> membershipListeners = 
Collections.emptyList();
-  
-  
-  private static volatile List<ClientMembershipListener> 
clientMembershipListeners = Collections.emptyList();
-  
-  /**
-   * Must be locked whenever references to the volatile field 
-   * {@link #membershipListeners} is changed.
-   */
-  private static final Object membershipLock = new Object();
-
-  /** 
-   * QueuedExecutor for firing BridgeMembershipEvents 
-   *
-   * Access synchronized via {@link #systems}
-   */
-  private static ThreadPoolExecutor executor;
-
-  private static final ThreadGroup threadGroup =
-      LoggingThreadGroup.createThreadGroup(
-          "BridgeMembership Event Invoker Group", logger);
-
-  /** List of connected <code>DistributedSystem</code>s */
-  private static final List systems = new ArrayList(1);
-
-  /**
-   * True if class is monitoring systems
-   * 
-   * @guarded.By InternalBridgeMembership.class
-   */
-  private static boolean isMonitoring = false;
-  
-  /**
-   * This work used to be in a class initializer.  Unfortunately, this allowed
-   * the class to escape before it was fully initialized, so now we just
-   * make sure this work is done before any public static method on it
-   * is invoked.
-   */
-  private static synchronized void startMonitoring() {
-    if (isMonitoring) {
-      return;
-    }
-    
-    synchronized(systems) {
-      // Initialize our own list of distributed systems via a connect listener
-      List existingSystems = InternalDistributedSystem.addConnectListener(
-        new InternalDistributedSystem.ConnectListener() {
-          public void onConnect(InternalDistributedSystem sys) {
-            addInternalDistributedSystem(sys);
-          }
-        });
-      
-      isMonitoring = true;
-      
-      // While still holding the lock on systems, add all currently known
-      // systems to our own list
-      for (Iterator iter = existingSystems.iterator(); iter.hasNext();) {
-        InternalDistributedSystem sys = (InternalDistributedSystem) 
iter.next();
-        try {
-          if (sys.isConnected()) {
-            addInternalDistributedSystem(sys);
-          }
-        }
-        catch (DistributedSystemDisconnectedException e) {
-          // it doesn't care (bug 37379)
-        }
-      }
-      
-    } // synchronized
-  }
-  
-  private InternalBridgeMembership() {}
-
-  /**
-   * Registers a {@link BridgeMembershipListener} for notification of
-   * connection changes for BridgeServers and bridge clients.
-   * @param listener a BridgeMembershipListener to be registered
-   * @deprecated use newer registerClientMembershipListener instead
-   */
-  public static void registerBridgeMembershipListener(BridgeMembershipListener 
listener) {
-    startMonitoring();
-    synchronized (membershipLock) {
-      List<BridgeMembershipListener> oldListeners = membershipListeners;
-      if (!oldListeners.contains(listener)) {
-        List<BridgeMembershipListener> newListeners = new 
ArrayList<BridgeMembershipListener>(oldListeners);
-        newListeners.add(listener);
-        membershipListeners = newListeners;
-      }
-    }
-  }
-  
-  /**
-   * Registers a {@link ClientMembershipListener} for notification of 
connection
-   * changes for CacheServer and clients.
-   * 
-   * @param listener
-   *          a ClientMembershipListener to be registered
-   */
-  public static void registerClientMembershipListener(ClientMembershipListener 
listener) {
-    startMonitoring();
-    synchronized (membershipLock) {
-      List<ClientMembershipListener> oldListeners = clientMembershipListeners;
-      if (!oldListeners.contains(listener)) {
-        List<ClientMembershipListener> newListeners = new 
ArrayList<ClientMembershipListener>(oldListeners);
-        newListeners.add(listener);
-        clientMembershipListeners = newListeners;
-      }
-    }
-  }
-  
-  /**
-   * Removes registration of a previously registered {@link
-   * BridgeMembershipListener}.
-   * @param listener a BridgeMembershipListener to be unregistered
-   * @deprecated
-   */
-  public static void 
unregisterBridgeMembershipListener(BridgeMembershipListener listener) {
-    startMonitoring();
-    synchronized (membershipLock) {
-      List<BridgeMembershipListener> oldListeners = membershipListeners;
-      if (oldListeners.contains(listener)) {
-        List<BridgeMembershipListener> newListeners = new 
ArrayList<BridgeMembershipListener>(oldListeners);
-        if (newListeners.remove(listener)) {
-          membershipListeners = newListeners;
-        }
-      }
-    }
-  }
-  
-  /**
-   * Removes registration of a previously registered
-   * {@link ClientMembershipListener}.
-   * 
-   * @param listener
-   *          a ClientMembershipListener to be unregistered
-   */
-  public static void 
unregisterClientMembershipListener(ClientMembershipListener listener) {
-    startMonitoring();
-    synchronized (membershipLock) {
-      List<ClientMembershipListener> oldListeners = clientMembershipListeners;
-      if (oldListeners.contains(listener)) {
-        List<ClientMembershipListener> newListeners = new 
ArrayList<ClientMembershipListener>(oldListeners);
-        if (newListeners.remove(listener)) {
-          clientMembershipListeners = newListeners;
-        }
-      }
-    }
-  }
-
-  /**
-   * Returns an array of all the currently registered
-   * <code>BridgeMembershipListener</code>s. Modifications to the returned
-   * array will not effect the registration of these listeners.
-   * @return the registered <code>BridgeMembershipListener</code>s; an empty
-   * array if no listeners
-   * @deprecated
-   */
-  public static BridgeMembershipListener[] getBridgeMembershipListeners() {
-    startMonitoring();
-    // Synchronization is not needed because we never modify this list
-    // in place.
-    
-    List<BridgeMembershipListener> l = membershipListeners; // volatile fetch
-    // convert to an array
-    BridgeMembershipListener[] listeners = (BridgeMembershipListener[]) 
-        l.toArray(new BridgeMembershipListener[l.size()]);
-    return listeners;
-  }
-  
-  /**
-   * Returns an array of all the currently registered
-   * <code>ClientMembershipListener</code>s. Modifications to the returned 
array
-   * will not effect the registration of these listeners.
-   * 
-   * @return the registered <code>ClientMembershipListener</code>s; an empty
-   *         array if no listeners
-   */
-  public static ClientMembershipListener[] getClientMembershipListeners() {
-    startMonitoring();
-    // Synchronization is not needed because we never modify this list
-    // in place.
-
-    List<ClientMembershipListener> l = clientMembershipListeners; // volatile 
fetch
-    // convert to an array
-    ClientMembershipListener[] listeners = (ClientMembershipListener[]) l
-        .toArray(new ClientMembershipListener[l.size()]);
-    return listeners;
-  }
-
-  /**
-   * Removes registration of all currently registered
-   * <code>BridgeMembershipListener<code>s. and 
<code>ClientMembershipListener<code>s.
-   */
-  public static void unregisterAllListeners() {
-    startMonitoring();
-    synchronized (membershipLock) {
-      membershipListeners = new ArrayList<BridgeMembershipListener>();
-      clientMembershipListeners = new ArrayList<ClientMembershipListener>();
-    }
-  }
-  
-  
-  
-  /**
-   * Returns a map of client memberIds to count of connections to that client.
-   * The map entry key is a String representation of the client memberId, and
-   * the map entry value is an Integer count of connections to that client.
-   * Since a single client can have multiple ConnectionProxy objects, this 
-   * map will contain all the Connection objects across the ConnectionProxies
-   * @param onlyClientsNotifiedByThisServer true will return only those clients
-   * that are actively being updated by this server
-   * @return map of client memberIds to count of connections to that client
-   * 
-   * 
-   */
-  public static Map getConnectedClients(boolean 
onlyClientsNotifiedByThisServer) {
-    ClientHealthMonitor chMon = ClientHealthMonitor.getInstance();
-    Set filterProxyIDs = null;
-    if(onlyClientsNotifiedByThisServer) {
-      // Note it is not necessary to synchronize on the list of bridge servers 
here, 
-      // since this is only a status (snapshot) of the system.
-      for (Iterator bsii = 
CacheFactory.getAnyInstance().getCacheServers().iterator(); bsii.hasNext(); ) {
-        CacheServerImpl bsi = (CacheServerImpl) bsii.next();
-        AcceptorImpl ai = bsi.getAcceptor();
-        if (ai != null && ai.getCacheClientNotifier() != null) {
-          if (filterProxyIDs != null) {
-            // notifierClients is a copy set from CacheClientNotifier
-            
filterProxyIDs.addAll(ai.getCacheClientNotifier().getActiveClients());
-          }
-          else {
-            // notifierClients is a copy set from CacheClientNotifier
-            filterProxyIDs = ai.getCacheClientNotifier().getActiveClients();
-          }
-        }
-      }
-    }
-
-    Map map = chMon.getConnectedClients(filterProxyIDs);
-   /*if (onlyClientsNotifiedByThisServer) {
-      Map notifyMap = new HashMap();
-      
-      for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
-        String memberId = (String) iter.next();
-        if (notifierClients.contains(memberId)) {
-          // found memberId that is notified by this server
-          notifyMap.put(memberId, map.get(memberId));
-        }
-      }
-      map = notifyMap;
-    }*/
-    return map;
-  }
-  
-  /**
-   * This method returns the CacheClientStatus for all the clients that are
-   * connected to this server. This method returns all clients irrespective of
-   * whether subscription is enabled or not. 
-   * 
-   * @return Map of ClientProxyMembershipID against CacheClientStatus objects.
-   */
-  public static Map getStatusForAllClientsIgnoreSubscriptionStatus() {
-    Map result = new HashMap();
-    if (ClientHealthMonitor.getInstance() != null)
-      result = ClientHealthMonitor.getInstance().getStatusForAllClients();
-
-    return result;
-  }  
-
-  /**
-   * Caller must synchronize on cache.allBridgeServersLock
-   * @return all the clients
-   */
-  public static Map getConnectedClients() {
-
-    // Get all clients
-    Map allClients = new HashMap();
-    for (Iterator bsii = 
CacheFactory.getAnyInstance().getCacheServers().iterator(); bsii.hasNext(); ) {
-      CacheServerImpl bsi = (CacheServerImpl) bsii.next();
-      AcceptorImpl ai = bsi.getAcceptor();
-      if (ai != null && ai.getCacheClientNotifier() != null) {
-        allClients.putAll(ai.getCacheClientNotifier().getAllClients());
-      }
-    }
-
-    // Fill in the missing info, if HealthMonitor started
-    if (ClientHealthMonitor.getInstance()!=null)
-        ClientHealthMonitor.getInstance().fillInClientInfo(allClients);
-
-    return allClients;
-  }
-
-  public static Map getClientQueueSizes() {
-    Map clientQueueSizes = new HashMap();
-    GemFireCacheImpl c =  (GemFireCacheImpl)CacheFactory.getAnyInstance();
-    if (c==null) // Add a NULL Check
-      return clientQueueSizes;
-
-    for (Iterator bsii = c.getCacheServers().iterator(); bsii.hasNext(); ) {
-      CacheServerImpl bsi = (CacheServerImpl) bsii.next();
-      AcceptorImpl ai = bsi.getAcceptor();
-      if (ai != null && ai.getCacheClientNotifier() != null) {
-        
clientQueueSizes.putAll(ai.getCacheClientNotifier().getClientQueueSizes());
-      }
-    } // for
-    return clientQueueSizes;
-  }
-
-  /**
-   * Returns a map of servers to count of pools connected to that server.
-   * The map entry key is a String representation of the server, 
-   * @return map of servers to count of pools using that server
-   */
-  public static Map getConnectedServers() {
-    final Map map = new HashMap(); // KEY:server (String), VALUE:List of 
active endpoints
-    // returns an unmodifiable set
-    Map/*<String,Pool>*/ poolMap = PoolManager.getAll();
-    Iterator pools = poolMap.values().iterator();
-    while(pools.hasNext()) {
-      PoolImpl pi = (PoolImpl)pools.next();
-      Map/*<ServerLocation,Endpoint>*/ eps = pi.getEndpointMap();
-      Iterator it = eps.entrySet().iterator();
-      while(it.hasNext()) {
-        Map.Entry entry = (Map.Entry)it.next();
-        ServerLocation loc = (ServerLocation)entry.getKey();
-        com.gemstone.gemfire.cache.client.internal.Endpoint ep = 
(com.gemstone.gemfire.cache.client.internal.Endpoint)entry.getValue();
-        String server = loc.getHostName()+"["+loc.getPort()+"]";
-        Integer count = (Integer)map.get(server);
-        if(count==null) {
-          map.put(server,Integer.valueOf(1));  
-        } else {
-          map.put(server,Integer.valueOf(count.intValue()+1));
-        }
-      }
-    }
-    return map;
-  }
-
-  public static Map getConnectedIncomingGateways() {
-    Map connectedIncomingGateways = null;
-    ClientHealthMonitor chMon = ClientHealthMonitor.getInstance();
-    if (chMon == null) {
-      connectedIncomingGateways = new HashMap();
-    } else {
-      connectedIncomingGateways = chMon.getConnectedIncomingGateways();
-    }
-    return connectedIncomingGateways;
-  }
-  
-  
-
-  /**
-   * Notifies registered listeners that a bridge member has joined. The new
-   * member may be a bridge client connecting to this process or a bridge
-   * server that this process has just connected to.
-   *
-   * @param member the <code>DistributedMember</code>
-   * @param client true if the member is a bridge client; false if bridge 
server
-   */
-  public static void notifyJoined(final DistributedMember member, final 
boolean client) {
-    startMonitoring();
-    ThreadPoolExecutor queuedExecutor = executor;
-    if (queuedExecutor == null) {
-      return;
-    }
-
-    final BridgeMembershipEvent event =
-        new InternalBridgeMembershipEvent(member, client);
-    if (forceSynchronous) {
-      doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_JOINED);
-      doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_JOINED);
-    }
-    else {
-      try {
-          queuedExecutor.execute(new Runnable() {
-              public void run() {
-                doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_JOINED);
-                doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_JOINED);
-              }
-            });
-      }
-      catch (RejectedExecutionException e) {
-        // executor must have been shutdown
-        }
-    }
-  }
-
-
-
-  /**
-   * Notifies registered listeners that a bridge member has left. The departed
-   * member may be a bridge client previously connected to this process or a
-   * bridge server that this process was connected to.
-   *
-   * @param member the <code>DistributedMember</code>
-   * @param client true if the member is a bridge client; false if bridge 
server
-   */
-  public static void notifyLeft(final DistributedMember member, final boolean 
client) {
-    startMonitoring();
-    ThreadPoolExecutor queuedExecutor = executor;
-    if (queuedExecutor == null) {
-      return;
-    }
-
-    
-    final BridgeMembershipEvent event =
-        new InternalBridgeMembershipEvent(member, client);
-    if (forceSynchronous) {
-      doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_LEFT);
-      doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_LEFT);
-    }
-    else {
-      try {
-          queuedExecutor.execute(new Runnable() {
-              public void run() {
-                doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_LEFT);
-                doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_LEFT);
-              }
-            });
-      }
-      catch (RejectedExecutionException e) {
-        // executor must have been shutdown
-        }
-    }
-  }
-
-
-  /**
-   * Notifies registered listeners that a bridge member has crashed. The
-   * departed member may be a bridge client previously connected to this
-   * process or a bridge server that this process was connected to.
-   *
-   * @param member the <code>DistributedMember</code>
-   * @param client true if the member is a bridge client; false if bridge 
server
-   */
-  public static void notifyCrashed(final DistributedMember member, final 
boolean client) {
-    ThreadPoolExecutor queuedExecutor = executor;
-    if (queuedExecutor == null) {
-      return;
-    }
-
-    final BridgeMembershipEvent event =
-        new InternalBridgeMembershipEvent(member, client);
-    if (forceSynchronous) {
-      doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_CRASHED);
-      doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_CRASHED);
-    }
-    else {
-
-      try {
-          queuedExecutor.execute(new Runnable() {
-            public void run() {
-              doNotifyClientMembershipListener(member, client, 
event,EventType.CLIENT_CRASHED);
-              doNotifyBridgeMembershipListener(member, client, 
event,EventType.CLIENT_CRASHED);
-            }
-          });
-      }
-      catch (RejectedExecutionException e) {
-        // executor must have been shutdown
-        }
-    }
-  }
-
-  private static void doNotifyClientMembershipListener(DistributedMember 
member, boolean client,
-      ClientMembershipEvent clientMembershipEvent, EventType eventType) {
-
-    for (Iterator<ClientMembershipListener> iter = 
clientMembershipListeners.iterator(); iter.hasNext();) {
-
-      ClientMembershipListener listener = iter.next();
-      try {
-        if (eventType.equals(EventType.CLIENT_JOINED)) {
-          listener.memberJoined(clientMembershipEvent);
-        } else if (eventType.equals(EventType.CLIENT_LEFT)) {
-          listener.memberLeft(clientMembershipEvent);
-        } else {
-          listener.memberCrashed(clientMembershipEvent);
-        }
-      } catch (CancelException e) {
-        // this can be thrown by a bridge server when the system is shutting
-        // down
-        return;
-      } catch (VirtualMachineError e) {
-        SystemFailure.initiateFailure(e);
-        throw e;
-      } catch (Throwable t) {
-        SystemFailure.checkFailure();
-        
logger.warn(LocalizedMessage.create(LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION),
 t);
-      }
-    }
-  }
-  
-  private static void doNotifyBridgeMembershipListener(DistributedMember 
member, boolean client,
-      BridgeMembershipEvent bridgeMembershipEvent, EventType eventType) {
-
-    for (Iterator<BridgeMembershipListener> iter = 
membershipListeners.iterator(); iter.hasNext();) {
-
-      BridgeMembershipListener listener = iter.next();
-      try {
-        if (eventType.equals(EventType.CLIENT_JOINED)) {
-          listener.memberJoined(bridgeMembershipEvent);
-        } else if (eventType.equals(EventType.CLIENT_LEFT)) {
-          listener.memberLeft(bridgeMembershipEvent);
-        } else {
-          listener.memberCrashed(bridgeMembershipEvent);
-        }
-      } catch (CancelException e) {
-        // this can be thrown by a bridge server when the system is shutting
-        // down
-        return;
-      } catch (VirtualMachineError e) {
-        SystemFailure.initiateFailure(e);
-        throw e;
-      } catch (Throwable t) {
-        SystemFailure.checkFailure();
-        
logger.warn(LocalizedMessage.create(LocalizedStrings.LocalRegion_UNEXPECTED_EXCEPTION),
 t);
-      }
-    }
-  }
-  
-
-//  /**
-//   * Returns true if there are any registered
-//   * <code>BridgeMembershipListener</code>s.
-//   */
-//  private static boolean hasBridgeMembershipListeners() {
-//    synchronized (membershipLock) {
-//      return !membershipListeners.isEmpty();
-//    }
-//  }
-
-  protected static void addInternalDistributedSystem(InternalDistributedSystem 
s) {
-    synchronized(systems) {
-      s.addDisconnectListener(
-        new InternalDistributedSystem.DisconnectListener() {
-          @Override
-          public String toString() {
-            return "Disconnect listener for InternalBridgeMembership";
-          }
-          
-          public void onDisconnect(InternalDistributedSystem ss) {
-            removeInternalDistributedSystem(ss);
-          }
-        });
-      systems.add(s);
-      // make sure executor is alive
-      ensureExecutorIsRunning(); // optimized to do nothing if already running
-    }
-  }
-
-  protected static void 
removeInternalDistributedSystem(InternalDistributedSystem sys) {
-    synchronized(systems) {
-      systems.remove(sys);
-      if (systems.isEmpty()) {
-        // clean up executor
-/*
-Object[] queueElementsBefore = new Object[executorQueue.size()];
-queueElementsBefore = executorQueue.toArray(queueElementsBefore);
-System.out.println("Before shut down, the executor's queue contains the 
following " + queueElementsBefore.length + " elements");
-for (int i=0; i<queueElementsBefore.length; i++) {
-  System.out.println("\t" + queueElementsBefore[i]);
-}
-*/
-        if (executor != null) {
-          executor.shutdown();
-        }
-/*
-Object[] queueElementsAfter = new Object[executorQueue.size()];
-queueElementsAfter = executorQueue.toArray(queueElementsAfter);
-System.out.println("After shut down, the executor's queue contains the 
following " + queueElementsAfter.length + " elements");
-for (int i=0; i<queueElementsAfter.length; i++) {
-  System.out.println("\t" + queueElementsAfter[i]);
-}
-*/
-        // deadcoded this clear to fix bug 35675 - clearing removed the 
shutdown token from the queue!
-        // executorQueue.clear();
-        executor = null;
-      }
-    }
-  }
-
-  /**
-   * @guarded.By {@link #systems}
-   */
-  private static void ensureExecutorIsRunning() {
-    // protected by calling method synchronized on systems
-    if (executor == null) {
-      final ThreadGroup group = threadGroup;
-      ThreadFactory tf = new ThreadFactory() {
-          public Thread newThread(Runnable command) {
-            Thread thread =
-                new Thread(group, command, "BridgeMembership Event Invoker");
-            thread.setDaemon(true);
-            return thread;
-          }
-        };
-      LinkedBlockingQueue q = new LinkedBlockingQueue();
-      executor = new ThreadPoolExecutor(1, 1/*max unused*/,
-                                        15, TimeUnit.SECONDS, q, tf);
-    }
-  }
-
-  /**
-   * Internal implementation of BridgeMembershipEvent.
-   */
-  protected static class InternalBridgeMembershipEvent
-  implements BridgeMembershipEvent,ClientMembershipEvent {
-
-    private final DistributedMember member;
-    private final boolean client;
-
-    /** Constructs new instance of event */
-    protected InternalBridgeMembershipEvent(DistributedMember member, boolean 
client) {
-      this.member = member;
-      this.client = client;
-    }
-
-    public DistributedMember getMember() {
-      return this.member;
-    }
-
-    public String getMemberId() {
-      return this.member == null ? "unknown" : this.member.getId();
-    }
-
-    public boolean isClient() {
-      return this.client;
-    }
-
-    @Override // GemStoneAddition
-    public String toString() {
-      final StringBuffer sb = new StringBuffer("[BridgeMembershipEvent: ");
-      sb.append("member=").append(this.member);
-      sb.append(", isClient=").append(this.client);
-      sb.append("]");
-      return sb.toString();
-    }
-  }
-  
-  /** If set to true for testing then notification will be synchronous */
-  private static boolean forceSynchronous = false;
-  /** Set to true if synchronous notification is needed for testing */
-  public static void setForceSynchronous(boolean value) {
-    forceSynchronous = value;
-  }
-  
-  private static enum EventType{
-    CLIENT_JOINED,
-    CLIENT_LEFT,
-    CLIENT_CRASHED
-  }
-}
-

Reply via email to