renamed some BridgeServer* classes to CacheServer*
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/51bddd70 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/51bddd70 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/51bddd70 Branch: refs/heads/feature/GEODE-243 Commit: 51bddd708bdf1862e878afa4869926419ce65982 Parents: 3eaf0e9 Author: Darrel Schneider <dschnei...@pivotal.io> Authored: Mon Aug 31 10:38:58 2015 -0700 Committer: Darrel Schneider <dschnei...@pivotal.io> Committed: Mon Aug 31 10:38:58 2015 -0700 ---------------------------------------------------------------------- .../cache/client/internal/AbstractOp.java | 2 +- .../cache/server/internal/LoadMonitor.java | 6 +- .../gemfire/distributed/ServerLauncher.java | 4 +- .../internal/InternalDistributedSystem.java | 10 +- .../distributed/internal/ServerLocator.java | 10 +- .../jgroup/JGroupMembershipManager.java | 6 +- .../gemstone/gemfire/internal/DSFIDFactory.java | 4 +- .../internal/DataSerializableFixedID.java | 2 +- .../admin/remote/BridgeServerResponse.java | 12 +- .../admin/remote/DurableClientInfoResponse.java | 2 +- .../admin/remote/RemoteBridgeServer.java | 10 +- .../internal/cache/AbstractBridgeServer.java | 424 ---------- .../internal/cache/AbstractCacheServer.java | 424 ++++++++++ .../internal/cache/BridgeServerAdvisor.java | 165 ---- .../internal/cache/BridgeServerImpl.java | 816 ------------------- .../gemfire/internal/cache/BucketAdvisor.java | 2 +- .../gemfire/internal/cache/CacheConfig.java | 8 +- .../internal/cache/CacheServerAdvisor.java | 164 ++++ .../gemfire/internal/cache/CacheServerImpl.java | 812 ++++++++++++++++++ .../cache/FindDurableQueueProcessor.java | 2 +- .../internal/cache/GemFireCacheImpl.java | 10 +- .../gemfire/internal/cache/GridAdvisor.java | 4 +- .../internal/cache/PartitionedRegion.java | 2 +- .../internal/cache/ha/HARegionQueue.java | 6 +- .../cache/tier/InternalBridgeMembership.java | 8 +- .../cache/tier/sockets/CacheClientNotifier.java | 4 +- .../tier/sockets/ClientBlacklistProcessor.java | 4 +- .../RemoveClientFromBlacklistMessage.java | 4 +- .../cache/xmlcache/BridgeServerCreation.java | 249 ------ .../internal/cache/xmlcache/CacheCreation.java | 14 +- .../cache/xmlcache/CacheServerCreation.java | 247 ++++++ .../internal/beans/CacheServerBridge.java | 4 +- .../beans/GatewayReceiverMBeanBridge.java | 4 +- .../management/internal/beans/ServerBridge.java | 6 +- .../cli/functions/ContunuousQueryFunction.java | 4 +- .../internal/LocatorLoadBalancingDUnitTest.java | 4 +- .../gemfire/cache30/Bug38741DUnitTest.java | 4 +- .../AbstractServerLauncherJUnitTestCase.java | 4 +- .../ServerLauncherLocalJUnitTest.java | 4 +- .../ServerLauncherRemoteJUnitTest.java | 8 +- .../internal/ProductUseLogDUnitTest.java | 2 +- .../disttx/DistributedTransactionDUnitTest.java | 4 +- ...ssagesRegionCreationAndDestroyJUnitTest.java | 4 +- .../cache/ClientServerTransactionDUnitTest.java | 6 +- .../cache/DeltaPropagationDUnitTest.java | 4 +- .../cache/DeltaPropagationStatsDUnitTest.java | 2 +- .../internal/cache/GridAdvisorDUnitTest.java | 56 +- .../HAOverflowMemObjectSizerDUnitTest.java | 4 +- .../cache/execute/Bug51193DUnitTest.java | 4 +- .../internal/cache/functions/TestFunction.java | 10 +- .../internal/cache/ha/HABugInPutDUnitTest.java | 4 +- .../internal/cache/ha/HAClearDUnitTest.java | 6 +- .../cache/ha/HAConflationDUnitTest.java | 4 +- .../internal/cache/ha/HADuplicateDUnitTest.java | 6 +- .../cache/ha/HAEventIdPropagationDUnitTest.java | 6 +- .../cache/ha/HARQueueNewImplDUnitTest.java | 34 +- .../ha/OperationsPropagationDUnitTest.java | 4 +- .../internal/cache/ha/PutAllDUnitTest.java | 6 +- .../cache/partitioned/Bug43684DUnitTest.java | 4 +- .../BridgeServerMaxConnectionsJUnitTest.java | 220 ----- ...geServerSelectorMaxConnectionsJUnitTest.java | 19 - .../tier/sockets/BridgeWriterMiscDUnitTest.java | 8 +- .../cache/tier/sockets/Bug37210DUnitTest.java | 4 +- .../CacheServerMaxConnectionsJUnitTest.java | 220 +++++ ...heServerSelectorMaxConnectionsJUnitTest.java | 19 + .../tier/sockets/ClientConflationDUnitTest.java | 4 +- .../sockets/ClientInterestNotifyDUnitTest.java | 6 +- .../cache/tier/sockets/ConflationDUnitTest.java | 4 +- .../DataSerializerPropogationDUnitTest.java | 6 +- .../DurableClientReconnectDUnitTest.java | 6 +- .../sockets/DurableClientStatsDUnitTest.java | 6 +- .../sockets/DurableRegistrationDUnitTest.java | 6 +- .../cache/tier/sockets/HAInterestBaseTest.java | 14 +- .../sockets/HAStartupAndFailoverDUnitTest.java | 10 +- .../tier/sockets/InterestListDUnitTest.java | 4 +- .../sockets/InterestListEndpointDUnitTest.java | 6 +- .../sockets/InterestListRecoveryDUnitTest.java | 4 +- .../tier/sockets/RedundancyLevelTestBase.java | 14 +- .../tier/sockets/RegionCloseDUnitTest.java | 6 +- ...erInterestBeforeRegionCreationDUnitTest.java | 4 +- 80 files changed, 2116 insertions(+), 2123 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/AbstractOp.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/AbstractOp.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/AbstractOp.java index ab11517..32f184e 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/AbstractOp.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/internal/AbstractOp.java @@ -19,7 +19,7 @@ import com.gemstone.gemfire.cache.client.ServerOperationException; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.Version; -import com.gemstone.gemfire.internal.cache.BridgeServerImpl; +import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.cache.PutAllPartialResultException; import com.gemstone.gemfire.internal.cache.TXManagerImpl; import com.gemstone.gemfire.internal.cache.tier.MessageType; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/cache/server/internal/LoadMonitor.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/server/internal/LoadMonitor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/server/internal/LoadMonitor.java index 6210f60..c516407 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/server/internal/LoadMonitor.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/server/internal/LoadMonitor.java @@ -19,7 +19,7 @@ import com.gemstone.gemfire.cache.server.ServerLoad; import com.gemstone.gemfire.cache.server.ServerLoadProbe; import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.distributed.internal.membership.MembershipManager; -import com.gemstone.gemfire.internal.cache.BridgeServerAdvisor; +import com.gemstone.gemfire.internal.cache.CacheServerAdvisor; import com.gemstone.gemfire.internal.cache.tier.Acceptor; import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerStats; import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID; @@ -41,14 +41,14 @@ public class LoadMonitor implements ConnectionListener { private final ServerLoadProbe probe; private final ServerMetricsImpl metrics; - protected final BridgeServerAdvisor advisor; + protected final CacheServerAdvisor advisor; protected ServerLocation location; private final PollingThread pollingThread; protected volatile ServerLoad lastLoad; protected CacheServerStats stats; public LoadMonitor(ServerLoadProbe probe, int maxConnections, - long pollInterval, int forceUpdateFrequency, BridgeServerAdvisor advisor) { + long pollInterval, int forceUpdateFrequency, CacheServerAdvisor advisor) { this.probe = probe; this.metrics = new ServerMetricsImpl(maxConnections); this.pollingThread = new PollingThread(pollInterval, forceUpdateFrequency); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java index a7cefbd..68efa34 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java @@ -40,7 +40,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.GemFireVersion; import com.gemstone.gemfire.internal.SocketCreator; -import com.gemstone.gemfire.internal.cache.AbstractBridgeServer; +import com.gemstone.gemfire.internal.cache.AbstractCacheServer; import com.gemstone.gemfire.internal.cache.CacheConfig; import com.gemstone.gemfire.internal.cache.CacheServerLauncher; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; @@ -205,7 +205,7 @@ public final class ServerLauncher extends AbstractLauncher<String> { } private static Integer getDefaultServerPort() { - return Integer.getInteger(AbstractBridgeServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, CacheServer.DEFAULT_PORT); + return Integer.getInteger(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, CacheServer.DEFAULT_PORT); } /** http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java index e30b20b..817ce99 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java @@ -74,14 +74,14 @@ import com.gemstone.gemfire.internal.StatisticsManager; import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl; import com.gemstone.gemfire.internal.SystemTimer; import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId; -import com.gemstone.gemfire.internal.cache.BridgeServerImpl; +import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.cache.CacheConfig; import com.gemstone.gemfire.internal.cache.EventID; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.execute.FunctionServiceStats; import com.gemstone.gemfire.internal.cache.execute.FunctionStats; import com.gemstone.gemfire.internal.cache.tier.sockets.HandShake; -import com.gemstone.gemfire.internal.cache.xmlcache.BridgeServerCreation; +import com.gemstone.gemfire.internal.cache.xmlcache.CacheServerCreation; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.internal.logging.LogService; @@ -2569,7 +2569,7 @@ public final class InternalDistributedSystem // the membership manager when forced-disconnect starts. If we're // reconnecting for lost roles then this will be null String cacheXML = null; - List<BridgeServerCreation> cacheServerCreation = null; + List<CacheServerCreation> cacheServerCreation = null; GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); boolean inhibitCacheForSQLFire = false; @@ -2835,8 +2835,8 @@ public final class InternalDistributedSystem } cache = GemFireCacheImpl.create(this.reconnectDS, config); if (cacheServerCreation != null) { - for (BridgeServerCreation bridge: cacheServerCreation) { - BridgeServerImpl impl = (BridgeServerImpl)cache.addCacheServer(); + for (CacheServerCreation bridge: cacheServerCreation) { + CacheServerImpl impl = (CacheServerImpl)cache.addCacheServer(); impl.configureFrom(bridge); try { if (!impl.isRunning()) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java index 33991bf..07cab82 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java @@ -46,7 +46,7 @@ import com.gemstone.gemfire.distributed.internal.tcpserver.TcpHandler; import com.gemstone.gemfire.distributed.internal.tcpserver.TcpServer; import com.gemstone.gemfire.i18n.LogWriterI18n; import com.gemstone.gemfire.internal.SocketCreator; -import com.gemstone.gemfire.internal.cache.BridgeServerAdvisor.BridgeServerProfile; +import com.gemstone.gemfire.internal.cache.CacheServerAdvisor.CacheServerProfile; import com.gemstone.gemfire.internal.cache.ControllerAdvisor; import com.gemstone.gemfire.internal.cache.ControllerAdvisor.ControllerProfile; import com.gemstone.gemfire.internal.cache.FindDurableQueueProcessor; @@ -375,8 +375,8 @@ public class ServerLocator implements TcpHandler, DistributionAdvisee { * @param profile */ public void profileCreated(Profile profile) { - if(profile instanceof BridgeServerProfile) { - BridgeServerProfile bp = (BridgeServerProfile) profile; + if(profile instanceof CacheServerProfile) { + CacheServerProfile bp = (CacheServerProfile) profile; ServerLocation location = buildServerLocation(bp); String[] groups = bp.getGroups(); loadSnapshot.addServer(location, groups, @@ -398,8 +398,8 @@ public class ServerLocator implements TcpHandler, DistributionAdvisee { * @param profile */ public void profileRemoved(Profile profile) { - if(profile instanceof BridgeServerProfile) { - BridgeServerProfile bp = (BridgeServerProfile) profile; + if(profile instanceof CacheServerProfile) { + CacheServerProfile bp = (CacheServerProfile) profile; //InternalDistributedMember id = bp.getDistributedMember(); ServerLocation location = buildServerLocation(bp); loadSnapshot.removeServer(location); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/jgroup/JGroupMembershipManager.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/jgroup/JGroupMembershipManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/jgroup/JGroupMembershipManager.java index c589feb..c18d250 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/jgroup/JGroupMembershipManager.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/jgroup/JGroupMembershipManager.java @@ -79,7 +79,7 @@ import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig; import com.gemstone.gemfire.internal.cache.DirectReplyMessage; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.xmlcache.BridgeServerCreation; +import com.gemstone.gemfire.internal.cache.xmlcache.CacheServerCreation; import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.LogService; @@ -2716,10 +2716,10 @@ public class JGroupMembershipManager implements MembershipManager } } else if (sharedConfigEnabled && !cache.getCacheServers().isEmpty()) { // we need to retain a cache-server description if this JVM was started by gfsh - List<BridgeServerCreation> list = new ArrayList<BridgeServerCreation>(cache.getCacheServers().size()); + List<CacheServerCreation> list = new ArrayList<CacheServerCreation>(cache.getCacheServers().size()); for (Iterator it = cache.getCacheServers().iterator(); it.hasNext(); ) { CacheServer cs = (CacheServer)it.next(); - BridgeServerCreation bsc = new BridgeServerCreation(cache, cs); + CacheServerCreation bsc = new CacheServerCreation(cache, cs); list.add(bsc); } cache.getCacheConfig().setCacheServerCreation(list); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java index 3c33553..0bb2b80 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java @@ -181,7 +181,7 @@ import com.gemstone.gemfire.internal.admin.statalerts.GaugeThresholdDecoratorImp import com.gemstone.gemfire.internal.admin.statalerts.NumberThresholdDecoratorImpl; import com.gemstone.gemfire.internal.cache.AddCacheServerProfileMessage; import com.gemstone.gemfire.internal.cache.BridgeRegionEventImpl; -import com.gemstone.gemfire.internal.cache.BridgeServerAdvisor.BridgeServerProfile; +import com.gemstone.gemfire.internal.cache.CacheServerAdvisor.CacheServerProfile; import com.gemstone.gemfire.internal.cache.BucketAdvisor; import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisor; import com.gemstone.gemfire.internal.cache.CloseCacheMessage; @@ -861,7 +861,7 @@ public final class DSFIDFactory implements DataSerializableFixedID { registerDSFID(FIND_DURABLE_QUEUE, FindDurableQueueMessage.class); registerDSFID(FIND_DURABLE_QUEUE_REPLY, FindDurableQueueReply.class); registerDSFID(BRIDGE_SERVER_LOAD_MESSAGE, BridgeServerLoadMessage.class); - registerDSFID(BRIDGE_SERVER_PROFILE, BridgeServerProfile.class); + registerDSFID(CACHE_SERVER_PROFILE, CacheServerProfile.class); registerDSFID(CONTROLLER_PROFILE, ControllerProfile.class); registerDSFID(DLOCK_QUERY_MESSAGE, DLockQueryProcessor.DLockQueryMessage.class); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java index a8a1715..3a34e75 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java @@ -135,7 +135,7 @@ public interface DataSerializableFixedID extends SerializationVersions { public static final byte PR_FUNCTION_REPLY_MESSAGE = -93; public static final byte PROFILES_REPLY_MESSAGE = -92; - public static final byte BRIDGE_SERVER_PROFILE = -91; + public static final byte CACHE_SERVER_PROFILE = -91; public static final byte CONTROLLER_PROFILE = -90; public static final byte CREATE_REGION_MESSAGE = -89; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/BridgeServerResponse.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/BridgeServerResponse.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/BridgeServerResponse.java index 8b362a9..6bfeef3 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/BridgeServerResponse.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/BridgeServerResponse.java @@ -12,7 +12,7 @@ import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.CacheFactory; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.internal.Assert; -import com.gemstone.gemfire.internal.cache.BridgeServerImpl; +import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import java.io.*; import java.util.*; @@ -55,8 +55,8 @@ public final class BridgeServerResponse extends AdminResponse { int operation = request.getOperation(); switch (operation) { case BridgeServerRequest.ADD_OPERATION: { - BridgeServerImpl bridge = - (BridgeServerImpl) cache.addCacheServer(); + CacheServerImpl bridge = + (CacheServerImpl) cache.addCacheServer(); m.bridgeInfo = new RemoteBridgeServer(bridge); break; } @@ -67,7 +67,7 @@ public final class BridgeServerResponse extends AdminResponse { // it is not necessary to synchronize on allBridgeServersLock for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext(); ) { - BridgeServerImpl bridge = (BridgeServerImpl) iter.next(); + CacheServerImpl bridge = (CacheServerImpl) iter.next(); if (System.identityHashCode(bridge) == id) { m.bridgeInfo = new RemoteBridgeServer(bridge); break; @@ -83,7 +83,7 @@ public final class BridgeServerResponse extends AdminResponse { RemoteBridgeServer config = request.getBridgeInfo(); for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext(); ) { - BridgeServerImpl bridge = (BridgeServerImpl) iter.next(); + CacheServerImpl bridge = (CacheServerImpl) iter.next(); if (System.identityHashCode(bridge) == config.getId()) { bridge.configureFrom(config); bridge.start(); @@ -101,7 +101,7 @@ public final class BridgeServerResponse extends AdminResponse { RemoteBridgeServer config = request.getBridgeInfo(); for (Iterator iter = cache.getCacheServers().iterator(); iter.hasNext(); ) { - BridgeServerImpl bridge = (BridgeServerImpl) iter.next(); + CacheServerImpl bridge = (CacheServerImpl) iter.next(); if (System.identityHashCode(bridge) == config.getId()) { bridge.stop(); m.bridgeInfo = new RemoteBridgeServer(bridge); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DurableClientInfoResponse.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DurableClientInfoResponse.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DurableClientInfoResponse.java index 3000753..ecd4967 100755 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DurableClientInfoResponse.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DurableClientInfoResponse.java @@ -47,7 +47,7 @@ public class DurableClientInfoResponse extends AdminResponse .getSystem()); if (c.getCacheServers().size() > 0) { - BridgeServerImpl server = (BridgeServerImpl)c.getCacheServers() + CacheServerImpl server = (CacheServerImpl)c.getCacheServers() .iterator().next(); switch (request.action) { case DurableClientInfoRequest.HAS_DURABLE_CLIENT_REQUEST: { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java index ec0bb34..cd40327 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteBridgeServer.java @@ -27,8 +27,8 @@ import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig; import com.gemstone.gemfire.internal.InternalDataSerializer; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.admin.AdminBridgeServer; -import com.gemstone.gemfire.internal.cache.AbstractBridgeServer; -import com.gemstone.gemfire.internal.cache.BridgeServerImpl; +import com.gemstone.gemfire.internal.cache.AbstractCacheServer; +import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; /** @@ -40,7 +40,7 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings; * @since 4.0 */ public class RemoteBridgeServer - extends AbstractBridgeServer + extends AbstractCacheServer implements AdminBridgeServer, DataSerializable { private static final long serialVersionUID = 8417391824652384959L; @@ -64,12 +64,12 @@ public class RemoteBridgeServer * <code>RemoteBridgeServer</code> from the contents of the given * <code>BridgeServerImpl</code>. */ - RemoteBridgeServer(BridgeServerImpl impl) { + RemoteBridgeServer(CacheServerImpl impl) { super(null); this.port = impl.getPort(); this.bindAddress = impl.getBindAddress(); this.hostnameForClients = impl.getHostnameForClients(); - if (BridgeServerImpl.ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE) { + if (CacheServerImpl.ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE) { this.notifyBySubscription = impl.getNotifyBySubscription(); } this.socketBufferSize = impl.getSocketBufferSize(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractBridgeServer.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractBridgeServer.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractBridgeServer.java deleted file mode 100644 index cefc698..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractBridgeServer.java +++ /dev/null @@ -1,424 +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; - -import com.gemstone.gemfire.CancelException; -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 java.io.IOException; -import java.util.Arrays; -import java.util.Set; - -/** - * Abstract class that contains common code that all true implementations - * of {@link CacheServer} can use. - * - * @author darrel - * @since 5.7 - */ -public abstract class AbstractBridgeServer implements CacheServer { - - public static final String TEST_OVERRIDE_DEFAULT_PORT_PROPERTY = "gemfire.test.CacheServer.OVERRIDE_DEFAULT_PORT"; - - /** The cache that is served by this bridge server */ - protected final InternalCache cache; - - /** The port that the bridge server was configured to run on */ - protected int port; - - /** The maximum number of connections that the BridgeServer will accept */ - protected int maxConnections; - - /** The maximum number of threads that the BridgeServer will create */ - protected int maxThreads; - - /** Whether the bridge server notifies by subscription */ - protected boolean notifyBySubscription = true; - - /** - * The buffer size in bytes of the socket for this - * <code>BridgeServer</code> - */ - protected int socketBufferSize; - - /** - * The tcpNoDelay setting for outgoing sockets - */ - protected boolean tcpNoDelay; - - /** - * The maximum amount of time between client pings. This value is used by - * the <code>ClientHealthMonitor</code> to determine the health of this - * <code>BridgeServer</code>'s clients. - */ - protected int maximumTimeBetweenPings; - - /** the maximum number of messages that can be enqueued in a client-queue. */ - protected int maximumMessageCount; - - /** - * the time (in seconds) after which a message in the client queue will - * expire. - */ - protected int messageTimeToLive; - /** - * The groups this server belongs to. Use <code>getGroups</code> to read. - * @since 5.7 - */ - protected String[] groups; - - protected ServerLoadProbe loadProbe; - - /** - * The ip address or host name that this server is to listen on. - * @since 5.7 - */ - protected String bindAddress; - /** - * The ip address or host name that will be given to clients so they can connect - * to this server - * @since 5.7 - */ - protected String hostnameForClients; - - /** - * How frequency to poll the load on this server. - */ - protected long loadPollInterval; - - 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. - */ - protected final BridgeMembershipListener listener; - - /** - * The number of seconds to keep transaction states for disconnected clients. - * This allows the client to fail over to another server and still find - * the transaction state to complete the transaction. - */ - private int transactionTimeToLive; - - ////////////////////// Constructors ////////////////////// - - /** - * Creates a new <code>BridgeServer</code> with the default - * configuration. - * - * @param cache - * The cache being served - */ - public AbstractBridgeServer(InternalCache cache) { - this(cache, true); - } - - public AbstractBridgeServer(InternalCache cache, boolean attachListener) { - this.cache = cache; - this.port = Integer.getInteger(TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, CacheServer.DEFAULT_PORT); - this.maxConnections = CacheServer.DEFAULT_MAX_CONNECTIONS; - this.maxThreads = CacheServer.DEFAULT_MAX_THREADS; - this.socketBufferSize = CacheServer.DEFAULT_SOCKET_BUFFER_SIZE; - this.tcpNoDelay = CacheServer.DEFAULT_TCP_NO_DELAY; - this.maximumTimeBetweenPings = CacheServer.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS; - this.maximumMessageCount = CacheServer.DEFAULT_MAXIMUM_MESSAGE_COUNT; - this.messageTimeToLive = CacheServer.DEFAULT_MESSAGE_TIME_TO_LIVE; - // TODO this should be configurable in CacheServer - this.transactionTimeToLive = Integer.getInteger("gemfire.cacheServer.transactionTimeToLive", 180); - this.groups = CacheServer.DEFAULT_GROUPS; - this.bindAddress = CacheServer.DEFAULT_BIND_ADDRESS; - this.hostnameForClients = CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS; - this.loadProbe = CacheServer.DEFAULT_LOAD_PROBE; - this.loadPollInterval = CacheServer.DEFAULT_LOAD_POLL_INTERVAL; - this.clientSubscriptionConfig = new ClientSubscriptionConfigImpl(); - - if (!attachListener) { - 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 - */ - @Override - public void memberJoined(BridgeMembershipEvent event) { - /* process events for clients only */ - 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 */ - 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 */ - 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 - * @param type - * type of event - one of ClientMembershipMessage.JOINED, - * ClientMembershipMessage.LEFT, ClientMembershipMessage.CRASHED - */ - private void createAndSendMessage(BridgeMembershipEvent event, int type) { - InternalDistributedSystem ds = null; - Cache cacheInstance = AbstractBridgeServer.this.cache; - if (cacheInstance != null && !(cacheInstance instanceof CacheCreation)) { - ds = (InternalDistributedSystem)cacheInstance.getDistributedSystem(); - } else { - ds = InternalDistributedSystem.getAnyInstance(); - } - - //ds could be null - if (ds != null && ds.isConnected()) { - DM dm = ds.getDistributionManager(); - Set adminMemberSet = dm.getAdminMemberSet(); - - /* check if there are any admin members at all */ - if (!adminMemberSet.isEmpty()) { - DistributedMember member = event.getMember(); - - ClientMembershipMessage msg = - new ClientMembershipMessage(event.getMemberId(), - member == null ? null : member.getHost(), - type); - - msg.setRecipients(adminMemberSet); - dm.putOutgoing(msg); - } - } - } - }; - - BridgeMembership.registerBridgeMembershipListener(listener); - } - - ///////////////////// Instance Methods ///////////////////// - - public int getPort() { - return this.port; - } - - public void setPort(int port) { - this.port = port; - } - - public String getBindAddress() { - return this.bindAddress; - } - - public void setBindAddress(String address) { - this.bindAddress = address; - } - - public String getHostnameForClients() { - return this.hostnameForClients; - } - - public void setHostnameForClients(String name) { - this.hostnameForClients = name; - } - - public int getMaxConnections() { - return this.maxConnections; - } - - public void setMaxConnections(int maxCon) { - this.maxConnections = maxCon; - } - - public int getMaxThreads() { - return this.maxThreads; - } - - public void setMaxThreads(int maxThreads) { - this.maxThreads = maxThreads; - } - - public void start() throws IOException { - // This method is invoked during testing, but it is not necessary - // to do anything. - } - - public void setNotifyBySubscription(boolean b) { - //this.notifyBySubscription = true; - } - - public boolean getNotifyBySubscription() { - return this.notifyBySubscription; - } - - public void setSocketBufferSize(int socketBufferSize) { - this.socketBufferSize = socketBufferSize; - } - - public int getSocketBufferSize() { - return this.socketBufferSize; - } - - public void setMaximumTimeBetweenPings(int maximumTimeBetweenPings) { - this.maximumTimeBetweenPings = maximumTimeBetweenPings; - } - - public int getMaximumTimeBetweenPings() { - return this.maximumTimeBetweenPings; - } - - public int getMaximumMessageCount() { - return this.maximumMessageCount; - } - - public void setMaximumMessageCount(int maximumMessageCount) { - this.maximumMessageCount = maximumMessageCount; - } - - public void setTransactionTimeToLive(int seconds) { - this.transactionTimeToLive = seconds; - } - - public int getTransactionTimeToLive() { - return this.transactionTimeToLive; - } - - public int getMessageTimeToLive() { - return this.messageTimeToLive; - } - - public void setMessageTimeToLive(int messageTimeToLive) { - this.messageTimeToLive = messageTimeToLive; - } - - public void setGroups(String[] groups) { - if (groups == null) { - this.groups = CacheServer.DEFAULT_GROUPS; - } - else if (groups.length > 0) { - // copy it for isolation - String [] copy = new String[groups.length]; - System.arraycopy(groups, 0, copy, 0, groups.length); - this.groups = copy; - } else { - this.groups = CacheServer.DEFAULT_GROUPS; // keep findbugs happy - } - } - - public String[] getGroups() { - String[] result = this.groups; - if (result.length > 0) { - // copy it for isolation - String [] copy = new String[result.length]; - System.arraycopy(result, 0, copy, 0, result.length); - result = copy; - } - return result; - } - - public ServerLoadProbe getLoadProbe() { - return loadProbe; - } - - public void setLoadProbe(ServerLoadProbe loadProbe) { - this.loadProbe = loadProbe; - } - - public long getLoadPollInterval() { - return loadPollInterval; - } - - public void setLoadPollInterval(long loadPollInterval) { - this.loadPollInterval = loadPollInterval; - } - - public void setTcpNoDelay(boolean setting) { - this.tcpNoDelay = setting; - } - - public boolean getTcpNoDelay() { - return this.tcpNoDelay; - } - - public Cache getCache() { - return this.cache; - } - - private static boolean eq(String s1, String s2) { - if (s1 == null) { - return s2 == null; - } else { - return s1.equals(s2); - } - } - - /** - * Returns whether or not this bridge server has the same - * configuration as another bridge server. - */ - public boolean sameAs(CacheServer other) { - return getPort() == other.getPort() - && eq(getBindAddress(), other.getBindAddress()) - && getSocketBufferSize() == other.getSocketBufferSize() - && getMaximumTimeBetweenPings() == other.getMaximumTimeBetweenPings() - && getNotifyBySubscription() == other.getNotifyBySubscription() - && getMaxConnections() == other.getMaxConnections() - && getMaxThreads() == other.getMaxThreads() - && getMaximumMessageCount() == other.getMaximumMessageCount() - && getMessageTimeToLive() == other.getMessageTimeToLive() - && Arrays.equals(getGroups(), other.getGroups()) - && getLoadProbe().equals(other.getLoadProbe()) - && getLoadPollInterval() == other.getLoadPollInterval() - && getTcpNoDelay() == other.getTcpNoDelay(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/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 new file mode 100644 index 0000000..855009d --- /dev/null +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java @@ -0,0 +1,424 @@ +/*========================================================================= + * 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; + +import com.gemstone.gemfire.CancelException; +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 java.io.IOException; +import java.util.Arrays; +import java.util.Set; + +/** + * Abstract class that contains common code that all true implementations + * of {@link CacheServer} can use. + * + * @author darrel + * @since 5.7 + */ +public abstract class AbstractCacheServer implements CacheServer { + + public static final String TEST_OVERRIDE_DEFAULT_PORT_PROPERTY = "gemfire.test.CacheServer.OVERRIDE_DEFAULT_PORT"; + + /** The cache that is served by this bridge server */ + protected final InternalCache cache; + + /** The port that the bridge server was configured to run on */ + protected int port; + + /** The maximum number of connections that the BridgeServer will accept */ + protected int maxConnections; + + /** The maximum number of threads that the BridgeServer will create */ + protected int maxThreads; + + /** Whether the bridge server notifies by subscription */ + protected boolean notifyBySubscription = true; + + /** + * The buffer size in bytes of the socket for this + * <code>BridgeServer</code> + */ + protected int socketBufferSize; + + /** + * The tcpNoDelay setting for outgoing sockets + */ + protected boolean tcpNoDelay; + + /** + * The maximum amount of time between client pings. This value is used by + * the <code>ClientHealthMonitor</code> to determine the health of this + * <code>BridgeServer</code>'s clients. + */ + protected int maximumTimeBetweenPings; + + /** the maximum number of messages that can be enqueued in a client-queue. */ + protected int maximumMessageCount; + + /** + * the time (in seconds) after which a message in the client queue will + * expire. + */ + protected int messageTimeToLive; + /** + * The groups this server belongs to. Use <code>getGroups</code> to read. + * @since 5.7 + */ + protected String[] groups; + + protected ServerLoadProbe loadProbe; + + /** + * The ip address or host name that this server is to listen on. + * @since 5.7 + */ + protected String bindAddress; + /** + * The ip address or host name that will be given to clients so they can connect + * to this server + * @since 5.7 + */ + protected String hostnameForClients; + + /** + * How frequency to poll the load on this server. + */ + protected long loadPollInterval; + + 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. + */ + protected final BridgeMembershipListener listener; + + /** + * The number of seconds to keep transaction states for disconnected clients. + * This allows the client to fail over to another server and still find + * the transaction state to complete the transaction. + */ + private int transactionTimeToLive; + + ////////////////////// Constructors ////////////////////// + + /** + * Creates a new <code>BridgeServer</code> with the default + * configuration. + * + * @param cache + * The cache being served + */ + public AbstractCacheServer(InternalCache cache) { + this(cache, true); + } + + public AbstractCacheServer(InternalCache cache, boolean attachListener) { + this.cache = cache; + this.port = Integer.getInteger(TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, CacheServer.DEFAULT_PORT); + this.maxConnections = CacheServer.DEFAULT_MAX_CONNECTIONS; + this.maxThreads = CacheServer.DEFAULT_MAX_THREADS; + this.socketBufferSize = CacheServer.DEFAULT_SOCKET_BUFFER_SIZE; + this.tcpNoDelay = CacheServer.DEFAULT_TCP_NO_DELAY; + this.maximumTimeBetweenPings = CacheServer.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS; + this.maximumMessageCount = CacheServer.DEFAULT_MAXIMUM_MESSAGE_COUNT; + this.messageTimeToLive = CacheServer.DEFAULT_MESSAGE_TIME_TO_LIVE; + // TODO this should be configurable in CacheServer + this.transactionTimeToLive = Integer.getInteger("gemfire.cacheServer.transactionTimeToLive", 180); + this.groups = CacheServer.DEFAULT_GROUPS; + this.bindAddress = CacheServer.DEFAULT_BIND_ADDRESS; + this.hostnameForClients = CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS; + this.loadProbe = CacheServer.DEFAULT_LOAD_PROBE; + this.loadPollInterval = CacheServer.DEFAULT_LOAD_POLL_INTERVAL; + this.clientSubscriptionConfig = new ClientSubscriptionConfigImpl(); + + if (!attachListener) { + 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 + */ + @Override + public void memberJoined(BridgeMembershipEvent event) { + /* process events for clients only */ + 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 */ + 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 */ + 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 + * @param type + * type of event - one of ClientMembershipMessage.JOINED, + * ClientMembershipMessage.LEFT, ClientMembershipMessage.CRASHED + */ + private void createAndSendMessage(BridgeMembershipEvent event, int type) { + InternalDistributedSystem ds = null; + Cache cacheInstance = AbstractCacheServer.this.cache; + if (cacheInstance != null && !(cacheInstance instanceof CacheCreation)) { + ds = (InternalDistributedSystem)cacheInstance.getDistributedSystem(); + } else { + ds = InternalDistributedSystem.getAnyInstance(); + } + + //ds could be null + if (ds != null && ds.isConnected()) { + DM dm = ds.getDistributionManager(); + Set adminMemberSet = dm.getAdminMemberSet(); + + /* check if there are any admin members at all */ + if (!adminMemberSet.isEmpty()) { + DistributedMember member = event.getMember(); + + ClientMembershipMessage msg = + new ClientMembershipMessage(event.getMemberId(), + member == null ? null : member.getHost(), + type); + + msg.setRecipients(adminMemberSet); + dm.putOutgoing(msg); + } + } + } + }; + + BridgeMembership.registerBridgeMembershipListener(listener); + } + + ///////////////////// Instance Methods ///////////////////// + + public int getPort() { + return this.port; + } + + public void setPort(int port) { + this.port = port; + } + + public String getBindAddress() { + return this.bindAddress; + } + + public void setBindAddress(String address) { + this.bindAddress = address; + } + + public String getHostnameForClients() { + return this.hostnameForClients; + } + + public void setHostnameForClients(String name) { + this.hostnameForClients = name; + } + + public int getMaxConnections() { + return this.maxConnections; + } + + public void setMaxConnections(int maxCon) { + this.maxConnections = maxCon; + } + + public int getMaxThreads() { + return this.maxThreads; + } + + public void setMaxThreads(int maxThreads) { + this.maxThreads = maxThreads; + } + + public void start() throws IOException { + // This method is invoked during testing, but it is not necessary + // to do anything. + } + + public void setNotifyBySubscription(boolean b) { + //this.notifyBySubscription = true; + } + + public boolean getNotifyBySubscription() { + return this.notifyBySubscription; + } + + public void setSocketBufferSize(int socketBufferSize) { + this.socketBufferSize = socketBufferSize; + } + + public int getSocketBufferSize() { + return this.socketBufferSize; + } + + public void setMaximumTimeBetweenPings(int maximumTimeBetweenPings) { + this.maximumTimeBetweenPings = maximumTimeBetweenPings; + } + + public int getMaximumTimeBetweenPings() { + return this.maximumTimeBetweenPings; + } + + public int getMaximumMessageCount() { + return this.maximumMessageCount; + } + + public void setMaximumMessageCount(int maximumMessageCount) { + this.maximumMessageCount = maximumMessageCount; + } + + public void setTransactionTimeToLive(int seconds) { + this.transactionTimeToLive = seconds; + } + + public int getTransactionTimeToLive() { + return this.transactionTimeToLive; + } + + public int getMessageTimeToLive() { + return this.messageTimeToLive; + } + + public void setMessageTimeToLive(int messageTimeToLive) { + this.messageTimeToLive = messageTimeToLive; + } + + public void setGroups(String[] groups) { + if (groups == null) { + this.groups = CacheServer.DEFAULT_GROUPS; + } + else if (groups.length > 0) { + // copy it for isolation + String [] copy = new String[groups.length]; + System.arraycopy(groups, 0, copy, 0, groups.length); + this.groups = copy; + } else { + this.groups = CacheServer.DEFAULT_GROUPS; // keep findbugs happy + } + } + + public String[] getGroups() { + String[] result = this.groups; + if (result.length > 0) { + // copy it for isolation + String [] copy = new String[result.length]; + System.arraycopy(result, 0, copy, 0, result.length); + result = copy; + } + return result; + } + + public ServerLoadProbe getLoadProbe() { + return loadProbe; + } + + public void setLoadProbe(ServerLoadProbe loadProbe) { + this.loadProbe = loadProbe; + } + + public long getLoadPollInterval() { + return loadPollInterval; + } + + public void setLoadPollInterval(long loadPollInterval) { + this.loadPollInterval = loadPollInterval; + } + + public void setTcpNoDelay(boolean setting) { + this.tcpNoDelay = setting; + } + + public boolean getTcpNoDelay() { + return this.tcpNoDelay; + } + + public Cache getCache() { + return this.cache; + } + + private static boolean eq(String s1, String s2) { + if (s1 == null) { + return s2 == null; + } else { + return s1.equals(s2); + } + } + + /** + * Returns whether or not this bridge server has the same + * configuration as another bridge server. + */ + public boolean sameAs(CacheServer other) { + return getPort() == other.getPort() + && eq(getBindAddress(), other.getBindAddress()) + && getSocketBufferSize() == other.getSocketBufferSize() + && getMaximumTimeBetweenPings() == other.getMaximumTimeBetweenPings() + && getNotifyBySubscription() == other.getNotifyBySubscription() + && getMaxConnections() == other.getMaxConnections() + && getMaxThreads() == other.getMaxThreads() + && getMaximumMessageCount() == other.getMaximumMessageCount() + && getMessageTimeToLive() == other.getMessageTimeToLive() + && Arrays.equals(getGroups(), other.getGroups()) + && getLoadProbe().equals(other.getLoadProbe()) + && getLoadPollInterval() == other.getLoadPollInterval() + && getTcpNoDelay() == other.getTcpNoDelay(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/51bddd70/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerAdvisor.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerAdvisor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerAdvisor.java deleted file mode 100644 index 733b762..0000000 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerAdvisor.java +++ /dev/null @@ -1,165 +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; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import com.gemstone.gemfire.DataSerializer; -import com.gemstone.gemfire.cache.server.ServerLoad; -import com.gemstone.gemfire.distributed.internal.DistributionAdvisee; -import com.gemstone.gemfire.distributed.internal.DistributionManager; -import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; -import com.gemstone.gemfire.internal.InternalDataSerializer; - - -/** - * Used to give advise to a bridge server. - * Bridge server currently need to know about controller's - * @author darrel - * - */ -public class BridgeServerAdvisor extends GridAdvisor { - - /** Creates a new instance of BridgeServerAdvisor */ - private BridgeServerAdvisor(DistributionAdvisee server) { - super(server); - } - - public static BridgeServerAdvisor createBridgeServerAdvisor(DistributionAdvisee server) { - BridgeServerAdvisor advisor = new BridgeServerAdvisor(server); - advisor.initialize(); - return advisor; - } - - @Override - public String toString() { - return "BridgeServerAdvisor for " + getAdvisee().getFullPath(); - } - - /** Instantiate new distribution profile for this member */ - @Override - protected Profile instantiateProfile( - InternalDistributedMember memberId, int version) { - return new BridgeServerProfile(memberId, version); - } - - /** - * Describes a bridge server for distribution purposes. - */ - public static class BridgeServerProfile extends GridAdvisor.GridProfile { - private String[] groups; - private int maxConnections; - private ServerLoad initialLoad; - private long loadPollInterval; - - /** for internal use, required for DataSerializer.readObject */ - public BridgeServerProfile() { - } - - public BridgeServerProfile(InternalDistributedMember memberId, int version) { - super(memberId, version); - } - - public BridgeServerProfile(BridgeServerProfile toCopy) { - super(toCopy); - this.groups = toCopy.groups; - } - - /** don't modify the returned array! */ - public String[] getGroups() { - return this.groups; - } - public void setGroups(String[] groups) { - this.groups = groups; - } - - public ServerLoad getInitialLoad() { - return initialLoad; - } - - public int getMaxConnections() { - return maxConnections; - } - - public void setMaxConnections(int maxConnections) { - this.maxConnections = maxConnections; - } - - public void setInitialLoad(ServerLoad initialLoad) { - this.initialLoad = initialLoad; - } - public long getLoadPollInterval() { - return this.loadPollInterval; - } - public void setLoadPollInterval(long v) { - this.loadPollInterval = v; - } - - /** - * Used to process an incoming bridge server profile. Any controller in this - * vm needs to be told about this incoming new bridge server. The reply - * needs to contain any controller(s) that exist in this vm. - * - * @since 5.7 - */ - @Override - public void processIncoming(DistributionManager dm, String adviseePath, - boolean removeProfile, boolean exchangeProfiles, - final List<Profile> replyProfiles) { - // tell local controllers about this bridge server - tellLocalControllers(removeProfile, exchangeProfiles, replyProfiles); - // for QRM messaging we need bridge servers to know about each other - tellLocalBridgeServers(removeProfile, exchangeProfiles, replyProfiles); - } - - @Override - public int getDSFID() { - return BRIDGE_SERVER_PROFILE; - } - - @Override - public void toData(DataOutput out) throws IOException { - super.toData(out); - DataSerializer.writeStringArray(this.groups, out); - out.writeInt(maxConnections); - InternalDataSerializer.invokeToData(initialLoad, out); - out.writeLong(getLoadPollInterval()); - } - - @Override - public void fromData(DataInput in) throws IOException, ClassNotFoundException { - super.fromData(in); - this.groups = DataSerializer.readStringArray(in); - this.maxConnections = in.readInt(); - this.initialLoad = new ServerLoad(); - InternalDataSerializer.invokeFromData(initialLoad, in); - setLoadPollInterval(in.readLong()); - } - - @Override - public StringBuilder getToStringHeader() { - return new StringBuilder("BridgeServerProfile"); - } - - @Override - public void fillInToString(StringBuilder sb) { - super.fillInToString(sb); - if (this.groups != null) { - sb.append("; groups=" + Arrays.asList(this.groups)); - sb.append("; maxConnections=" + maxConnections); - sb.append("; initialLoad=" + initialLoad); - sb.append("; loadPollInterval=" + getLoadPollInterval()); - } - } - } -}