You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by vf...@apache.org on 2015/11/25 20:07:55 UTC
[42/50] [abbrv] incubator-geode git commit: GEODE-243: remove
deprecated Bridge feature
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteGemFireVM.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteGemFireVM.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteGemFireVM.java
index 8c18e61..ab64026 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteGemFireVM.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/RemoteGemFireVM.java
@@ -672,7 +672,7 @@ public abstract class RemoteGemFireVM implements GemFireVM {
return setCacheConfigValue(c, SEARCH_TIMEOUT_CODE, v);
}
- public AdminBridgeServer addBridgeServer(CacheInfo cache)
+ public AdminBridgeServer addCacheServer(CacheInfo cache)
throws AdminException {
BridgeServerRequest request =
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/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 383239e..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractBridgeServer.java
+++ /dev/null
@@ -1,425 +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.cache.util.BridgeServer;
-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, BridgeServer {
-
- 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/2eb4e175/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..42b6bcd
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractCacheServer.java
@@ -0,0 +1,398 @@
+/*=========================================================================
+ * 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.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;
+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;
+
+ /**
+ * Listens to client membership events and notifies any admin
+ * members as clients of this server leave/crash.
+ */
+ protected final ClientMembershipListener 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 ClientMembershipListener() {
+
+ @Override
+ public void memberJoined(ClientMembershipEvent event) {
+ if (event.isClient()) {
+ createAndSendMessage(event, ClientMembershipMessage.JOINED);
+ }
+ }
+
+ @Override
+ public void memberLeft(ClientMembershipEvent event) {
+ if (event.isClient()) {
+ createAndSendMessage(event, ClientMembershipMessage.LEFT);
+ }
+ }
+
+ @Override
+ 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
+ * describes a change in client membership
+ * @param type
+ * type of event - one of ClientMembershipMessage.JOINED,
+ * ClientMembershipMessage.LEFT, ClientMembershipMessage.CRASHED
+ */
+ private void createAndSendMessage(ClientMembershipEvent 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);
+ }
+ }
+ }
+ };
+
+ ClientMembership.registerClientMembershipListener(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/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
index 90dcb41..344155b 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
@@ -74,9 +74,6 @@ import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
import com.gemstone.gemfire.cache.query.internal.index.IndexManager;
import com.gemstone.gemfire.cache.snapshot.RegionSnapshotService;
-import com.gemstone.gemfire.cache.util.BridgeClient;
-import com.gemstone.gemfire.cache.util.BridgeLoader;
-import com.gemstone.gemfire.cache.util.BridgeWriter;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.distributed.DistributedMember;
@@ -486,9 +483,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
*/
public CacheLoader basicGetLoader() {
CacheLoader result = this.cacheLoader;
- if (isBridgeLoader(result)) {
- result = null;
- }
return result;
}
/**
@@ -498,9 +492,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
*/
public CacheWriter basicGetWriter() {
CacheWriter result = this.cacheWriter;
- if (isBridgeWriter(result)) {
- result = null;
- }
return result;
}
@@ -1200,11 +1191,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
// synchronized so not reentrant
public synchronized CacheLoader setCacheLoader(CacheLoader cl) {
checkReadiness();
- if (cl != null && isBridgeLoader(cl)) {
- if (getPoolName() != null) {
- throw new IllegalStateException("A region with a connection pool can not have a BridgeLoader.");
- }
- }
CacheLoader oldLoader = this.cacheLoader;
assignCacheLoader(cl);
cacheLoaderChanged(oldLoader);
@@ -1213,24 +1199,12 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
private synchronized void assignCacheLoader(CacheLoader cl) {
this.cacheLoader = cl;
- if (cl instanceof BridgeLoader) {
- BridgeLoader bl = (BridgeLoader) cl;
- bl.attach(this);
- } else if (cl instanceof BridgeClient) {
- BridgeClient bc = (BridgeClient)cl;
- bc.attach(this);
- }
}
// synchronized so not reentrant
public synchronized CacheWriter setCacheWriter(CacheWriter cacheWriter)
{
checkReadiness();
- if (cacheWriter != null && isBridgeWriter(cacheWriter)) {
- if (getPoolName() != null) {
- throw new IllegalStateException("A region with a connection pool can not have a BridgeWriter.");
- }
- }
CacheWriter oldWriter = this.cacheWriter;
assignCacheWriter(cacheWriter);
cacheWriterChanged(oldWriter);
@@ -1240,10 +1214,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
private synchronized void assignCacheWriter(CacheWriter cacheWriter)
{
this.cacheWriter = cacheWriter;
- if (cacheWriter instanceof BridgeWriter) {
- BridgeWriter bw = (BridgeWriter)cacheWriter;
- bw.attach(this);
- }
}
void checkEntryTimeoutAction(String mode, ExpirationAction ea) {
@@ -1572,15 +1542,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
protected void closeCacheCallback(CacheCallback cb)
{
if (cb != null) {
- if (cb instanceof BridgeWriter) {
- BridgeWriter bw = (BridgeWriter)cb;
- bw.detach(this);
- }
- else if (cb instanceof BridgeLoader) {
- BridgeLoader bl = (BridgeLoader)cb;
- bl.detach(this);
- }
-
try {
cb.close();
}
@@ -1610,19 +1571,6 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
// nothing needed by default
}
- /**
- * @since 5.7
- */
- public static boolean isBridgeLoader(CacheLoader cl) {
- return cl instanceof BridgeLoader || cl instanceof BridgeClient;
- }
- /**
- * @since 5.7
- */
- public static boolean isBridgeWriter(CacheWriter cw) {
- return cw instanceof BridgeWriter;
- }
-
protected void cacheWriterChanged(CacheWriter oldWriter)
{
if (this.cacheWriter != oldWriter) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserver.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserver.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserver.java
deleted file mode 100755
index d8b41a2..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserver.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.internal.cache;
-
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
-
-/**
- * This interface is used by testing/debugging code to be notified of different
- * events. See the documentation for class BridgeObserverHolder for details.
- *
- * @author Yogesh Mahajan
- * @since 5.1
- *
- */
-public interface BridgeObserver
-{
- /**
- * This callback is called when now primary Ep is identified.
- */
- public void afterPrimaryIdentificationFromBackup(ServerLocation location);
-
- /**
- * This callback is called just before interest registartion
- */
- public void beforeInterestRegistration();
-
- /**
- * This callback is called just after interest registartion
- */
- public void afterInterestRegistration();
-
- /**
- * This callback is called just before primary identification
- */
- public void beforePrimaryIdentificationFromBackup();
-
- /**
- * This callback is called just before Interest Recovery by DSM thread happens
- */
- public void beforeInterestRecovery();
-
- /**
- * Invoked by CacheClientUpdater just before invoking endpointDied for
- * fail over
- * @param location ServerLocation which has failed
- */
- public void beforeFailoverByCacheClientUpdater(ServerLocation location);
- /**
- * Invoked before sending an instantiator message to server
- *
- * @param eventId
- */
- public void beforeSendingToServer(EventID eventId);
- /**
- * Invoked after sending an instantiator message to server
- *
- * @param eventId
- */
- public void afterReceivingFromServer(EventID eventId);
-
- /**
- * This callback is called just before sending client ack to the primary servrer.
- */
- public void beforeSendingClientAck();
-
- /**
- * Invoked after Message is created
- *
- * @param msg
- */
- public void afterMessageCreation(Message msg);
-
- /**
- * Invoked after Queue Destroy Message has been sent
- */
- public void afterQueueDestroyMessage();
-
- /**
- * Invoked after a primary is recovered from a backup or new connection.
- */
- public void afterPrimaryRecovered(ServerLocation location);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverAdapter.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverAdapter.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverAdapter.java
deleted file mode 100755
index 0dce187..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverAdapter.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.internal.cache;
-
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
-
-/**
- * This class provides 'do-nothing' implementations of all of the methods of
- * interface BridgeObserver. See the documentation for class
- * BridgeObserverHolder for details.
- *
- * @author Yogesh Mahajan
- * @since 5.1
- */
-public class BridgeObserverAdapter implements BridgeObserver
-{
- /**
- * This callback is called when now primary Ep is identified.
- */
- public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint)
- {
- }
-
- /**
- * This callback is called just before interest registartion
- */
- public void beforeInterestRegistration()
- {
- }
-
- /**
- * This callback is called just after interest registartion
- */
- public void afterInterestRegistration()
- {
- }
-
- /**
- * This callback is called just before primary identification
- */
- public void beforePrimaryIdentificationFromBackup()
- {
- }
-
- /**
- * This callback is called just before Interest Recovery by DSM thread happens
- */
- public void beforeInterestRecovery()
- {
-
- }
-
- public void beforeFailoverByCacheClientUpdater(ServerLocation epFailed)
- {
- }
- /**
- * Invoked before sending an instantiator message to server
- *
- * @param eventId
- */
- public void beforeSendingToServer(EventID eventId){
-
- }
- /**
- * Invoked after sending an instantiator message to server
- *
- * @param eventId
- */
- public void afterReceivingFromServer(EventID eventId){
-
- }
-
- /**
- * This callback is called just before sending client ack to the primary servrer.
- */
- public void beforeSendingClientAck(){
-
- }
-
- /**
- * Invoked after Message is created
- *
- * @param msg
- */
- public void afterMessageCreation(Message msg){
-
- }
-
- /**
- * Invoked after Queue Destroy Message has been sent
- */
- public void afterQueueDestroyMessage(){
-
- }
-
- /**
- * Invoked after a primary is recovered from a backup or new connection.
- */
- public void afterPrimaryRecovered(ServerLocation location) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverHolder.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverHolder.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverHolder.java
deleted file mode 100755
index d68a608..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeObserverHolder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.internal.cache;
-
-import com.gemstone.gemfire.cache.query.internal.Support;
-
-/**
- * This class is intended to hold a single 'observer' which will receive
- * callbacks. There can be only one such observer at a time. If no observer is
- * needed, this member variable should point to an object with 'do-nothing'
- * methods, such as BridgeObserverAdapter.
- *
- * @author Yogesh Mahajan
- * @since 5.1
- */
-public class BridgeObserverHolder
- {
-
- /**
- * The default 'do-nothing' bridge observer *
- */
- private static final BridgeObserver NO_OBSERVER = new BridgeObserverAdapter();
-
- /**
- * The current observer which will be notified of all query events.
- */
- private static BridgeObserver _instance = NO_OBSERVER;
-
- /**
- * Set the given observer to be notified of events. Returns the current
- * observer.
- */
- public static final BridgeObserver setInstance(BridgeObserver observer)
- {
- Support.assertArg(observer != null,
- "setInstance expects a non-null argument!");
- BridgeObserver oldObserver = _instance;
- _instance = observer;
- return oldObserver;
- }
-
- /** Return the current BridgeObserver instance */
- public static final BridgeObserver getInstance()
- {
- return _instance;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeRegionEventImpl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeRegionEventImpl.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeRegionEventImpl.java
deleted file mode 100755
index 7bcaf64..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeRegionEventImpl.java
+++ /dev/null
@@ -1,108 +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 com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.Operation;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
-
-//import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
-
-/**
- * Class <code>BridgeRegionEventImpl</code> is an implementation of a bridge
- * region event, which is just an <code>RegionEvent</code> with the client's
- * host and port for notification purposes.
- *
- * @author Girish Thombare
- *
- * @since 5.1
- */
-public final class BridgeRegionEventImpl extends RegionEventImpl
- {
-
- /**
- * The originating membershipId of this event.
- */
- private ClientProxyMembershipID context;
-
- public BridgeRegionEventImpl() {
- }
-
- /**
- * To be called from the Distributed Message without setting EventID
- * @param region
- * @param op
- * @param callbackArgument
- * @param originRemote
- * @param distributedMember
- */
- public BridgeRegionEventImpl(LocalRegion region, Operation op, Object callbackArgument,boolean originRemote, DistributedMember distributedMember,ClientProxyMembershipID contx) {
- super(region, op,callbackArgument, originRemote,distributedMember);
- setContext(contx);
- }
-
- public BridgeRegionEventImpl(LocalRegion region, Operation op, Object callbackArgument,boolean originRemote, DistributedMember distributedMember,ClientProxyMembershipID contx,EventID eventId) {
- super(region, op,callbackArgument, originRemote,distributedMember, eventId);
- setContext(contx);
- }
-
-
- /**
- * sets The membershipId originating this event
- *
- */
- protected void setContext(ClientProxyMembershipID contx)
- {
- this.context = contx;
- }
-
- /**
- * Returns The context originating this event
- *
- * @return The context originating this event
- */
- @Override
- public ClientProxyMembershipID getContext()
- {
- return this.context;
- }
-
- @Override
- public String toString()
- {
- String superStr = super.toString();
- StringBuffer buffer = new StringBuffer();
- String str = superStr.substring(0, superStr.length() - 1);
- buffer.append(str).append(";context=").append(getContext()).append(']');
- return buffer.toString();
- }
-
- @Override
- public int getDSFID() {
- return BRIDGE_REGION_EVENT;
- }
-
- @Override
- public void toData(DataOutput out) throws IOException
- {
- super.toData(out);
- DataSerializer.writeObject(getContext(), out);
- }
-
- @Override
- public void fromData(DataInput in) throws IOException, ClassNotFoundException
- {
- super.fromData(in);
- setContext(ClientProxyMembershipID.readCanonicalized(in));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/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());
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerImpl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerImpl.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerImpl.java
deleted file mode 100644
index f7fa15f..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BridgeServerImpl.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.internal.cache;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.CancelCriterion;
-import com.gemstone.gemfire.GemFireIOException;
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.InvalidValueException;
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.ClientSession;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.DynamicRegionFactory;
-import com.gemstone.gemfire.cache.EvictionAction;
-import com.gemstone.gemfire.cache.ExpirationAction;
-import com.gemstone.gemfire.cache.ExpirationAttributes;
-import com.gemstone.gemfire.cache.InterestRegistrationListener;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.RegionExistsException;
-import com.gemstone.gemfire.cache.Scope;
-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;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisee;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisor;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ResourceEvent;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
-import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.internal.OSProcess;
-import com.gemstone.gemfire.internal.admin.ClientHealthMonitoringRegion;
-import com.gemstone.gemfire.internal.cache.BridgeServerAdvisor.BridgeServerProfile;
-import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
-import com.gemstone.gemfire.internal.cache.tier.Acceptor;
-import com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
-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;
-
-/**
- * An implementation of the <code>CacheServer</code> interface that delegates
- * most of the heavy lifting to an {@link Acceptor}.
- *
- * @author David Whitlock
- * @since 4.0
- */
-@SuppressWarnings("deprecation")
-public class BridgeServerImpl
- extends AbstractBridgeServer
- implements DistributionAdvisee {
-
- private static final Logger logger = LogService.getLogger();
-
- private static final int FORCE_LOAD_UPDATE_FREQUENCY= Integer.getInteger("gemfire.BridgeServer.FORCE_LOAD_UPDATE_FREQUENCY", 10).intValue();
-
- /** The acceptor that does the actual serving */
- private volatile AcceptorImpl acceptor;
-
- // moved to AbstractBridgeServer
-
-
-
- /**
- * The advisor used by this bridge sever.
- * @since 5.7
- */
- private volatile BridgeServerAdvisor advisor;
-
- /**
- * The monitor used to monitor load on this
- * bridge server and distribute load to the locators
- * @since 5.7
- */
- private volatile LoadMonitor loadMonitor;
-
- /**
- * boolean that represents whether this server is a GatewayReceiver or a simple BridgeServer
- */
- private boolean isGatewayReceiver;
-
- private List<GatewayTransportFilter> gatewayTransportFilters = Collections.EMPTY_LIST;
-
- /**
- * Needed because this guy is an advisee
- * @since 5.7
- */
- private int serialNumber; // changed on each start
-
- public static final boolean ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE =
- Boolean.getBoolean("gemfire.cache-server.enable-notify-by-subscription-false");
-
-
- // ////////////////////// Constructors //////////////////////
-
- /**
- * Creates a new <code>BridgeServerImpl</code> that serves the contents of
- * the give <code>Cache</code>. It has the default configuration.
- */
- public BridgeServerImpl(GemFireCacheImpl cache, boolean isGatewayReceiver) {
- super(cache);
- this.isGatewayReceiver = isGatewayReceiver;
- }
-
- // //////////////////// Instance Methods ///////////////////
-
- public CancelCriterion getCancelCriterion() {
- return cache.getCancelCriterion();
- }
-
- /**
- * Checks to see whether or not this bridge server is running. If so, an
- * {@link IllegalStateException} is thrown.
- */
- private void checkRunning() {
- if (this.isRunning()) {
- throw new IllegalStateException(LocalizedStrings.BridgeServerImpl_A_BRIDGE_SERVERS_CONFIGURATION_CANNOT_BE_CHANGED_ONCE_IT_IS_RUNNING.toLocalizedString());
- }
- }
-
- public boolean isGatewayReceiver() {
- return this.isGatewayReceiver;
- }
-
- @Override
- public int getPort() {
- if (this.acceptor != null) {
- return this.acceptor.getPort();
- }
- else {
- return super.getPort();
- }
- }
-
- @Override
- public void setPort(int port) {
- checkRunning();
- super.setPort(port);
- }
-
- @Override
- public void setBindAddress(String address) {
- checkRunning();
- super.setBindAddress(address);
- }
- @Override
- public void setHostnameForClients(String name) {
- checkRunning();
- super.setHostnameForClients(name);
- }
-
- @Override
- public void setMaxConnections(int maxCon) {
- checkRunning();
- super.setMaxConnections(maxCon);
- }
-
- @Override
- public void setMaxThreads(int maxThreads) {
- checkRunning();
- super.setMaxThreads(maxThreads);
- }
-
- @Override
- public void setNotifyBySubscription(boolean b) {
- checkRunning();
- if (BridgeServerImpl.ENABLE_NOTIFY_BY_SUBSCRIPTION_FALSE) {
- this.notifyBySubscription = b;
- }
- }
-
- @Override
- public void setMaximumMessageCount(int maximumMessageCount) {
- checkRunning();
- super.setMaximumMessageCount(maximumMessageCount);
- }
-
- @Override
- public void setSocketBufferSize(int socketBufferSize) {
- this.socketBufferSize = socketBufferSize;
- }
-
- @Override
- public int getSocketBufferSize() {
- return this.socketBufferSize;
- }
-
- @Override
- public void setMaximumTimeBetweenPings(int maximumTimeBetweenPings) {
- this.maximumTimeBetweenPings = maximumTimeBetweenPings;
- }
-
- @Override
- public int getMaximumTimeBetweenPings() {
- return this.maximumTimeBetweenPings;
- }
-
-
- @Override
- public void setLoadPollInterval(long loadPollInterval) {
- checkRunning();
- super.setLoadPollInterval(loadPollInterval);
- }
-
- @Override
- public int getMaximumMessageCount() {
- return this.maximumMessageCount;
- }
-
- @Override
- public void setLoadProbe(ServerLoadProbe loadProbe) {
- checkRunning();
- super.setLoadProbe(loadProbe);
- }
-
- public void setGatewayTransportFilter(
- List<GatewayTransportFilter> transportFilters) {
- this.gatewayTransportFilters = transportFilters;
- }
-
- @Override
- public int getMessageTimeToLive() {
- return this.messageTimeToLive;
- }
-
-
- public ClientSubscriptionConfig getClientSubscriptionConfig(){
- return this.clientSubscriptionConfig;
- }
-
- /**
- * Sets the configuration of <b>this</b> <code>CacheServer</code> based on
- * the configuration of <b>another</b> <code>CacheServer</code>.
- */
- public void configureFrom(CacheServer other) {
- setPort(other.getPort());
- setBindAddress(other.getBindAddress());
- setHostnameForClients(other.getHostnameForClients());
- setMaxConnections(other.getMaxConnections());
- setMaxThreads(other.getMaxThreads());
- setNotifyBySubscription(other.getNotifyBySubscription());
- setSocketBufferSize(other.getSocketBufferSize());
- setTcpNoDelay(other.getTcpNoDelay());
- setMaximumTimeBetweenPings(other.getMaximumTimeBetweenPings());
- setMaximumMessageCount(other.getMaximumMessageCount());
- setMessageTimeToLive(other.getMessageTimeToLive());
-// setTransactionTimeToLive(other.getTransactionTimeToLive()); not implemented in CacheServer for v6.6
- setGroups(other.getGroups());
- setLoadProbe(other.getLoadProbe());
- setLoadPollInterval(other.getLoadPollInterval());
- ClientSubscriptionConfig cscOther = other.getClientSubscriptionConfig();
- ClientSubscriptionConfig cscThis = this.getClientSubscriptionConfig();
- // added for configuration of ha overflow
- cscThis.setEvictionPolicy(cscOther.getEvictionPolicy());
- cscThis.setCapacity(cscOther.getCapacity());
- String diskStoreName = cscOther.getDiskStoreName();
- if (diskStoreName != null) {
- cscThis.setDiskStoreName(diskStoreName);
- } else {
- cscThis.setOverflowDirectory(cscOther.getOverflowDirectory());
- }
- }
-
- @Override
- public synchronized void start() throws IOException {
- Assert.assertTrue(this.cache != null);
- boolean isSqlFabricSystem = ((GemFireCacheImpl)this.cache).isSqlfSystem();
-
- this.serialNumber = createSerialNumber();
- if (DynamicRegionFactory.get().isOpen()) {
- // force notifyBySubscription to be true so that meta info is pushed
- // from servers to clients instead of invalidates.
- if (!this.notifyBySubscription) {
- logger.info(LocalizedMessage.create(LocalizedStrings.BridgeServerImpl_FORCING_NOTIFYBYSUBSCRIPTION_TO_SUPPORT_DYNAMIC_REGIONS));
- this.notifyBySubscription = true;
- }
- }
- this.advisor = BridgeServerAdvisor.createBridgeServerAdvisor(this);
- this.loadMonitor = new LoadMonitor(loadProbe, maxConnections,
- loadPollInterval, FORCE_LOAD_UPDATE_FREQUENCY,
- advisor);
- List overflowAttributesList = new LinkedList();
- ClientSubscriptionConfig csc = this.getClientSubscriptionConfig();
- overflowAttributesList.add(0, csc.getEvictionPolicy());
- overflowAttributesList.add(1, Integer.valueOf(csc.getCapacity()));
- overflowAttributesList.add(2, Integer.valueOf(this.port));
- String diskStoreName = csc.getDiskStoreName();
- if (diskStoreName != null) {
- overflowAttributesList.add(3, diskStoreName);
- overflowAttributesList.add(4, true); // indicator to use diskstore
- } else {
- overflowAttributesList.add(3, csc.getOverflowDirectory());
- overflowAttributesList.add(4, false);
- }
-
- this.acceptor = new AcceptorImpl(getPort(),
- getBindAddress(),
- getNotifyBySubscription(),
- getSocketBufferSize(),
- getMaximumTimeBetweenPings(),
- this.cache,
- getMaxConnections(),
- getMaxThreads(),
- getMaximumMessageCount(),
- getMessageTimeToLive(),
- getTransactionTimeToLive(),
- this.loadMonitor,
- overflowAttributesList,
- isSqlFabricSystem,
- this.isGatewayReceiver,
- this.gatewayTransportFilters, this.tcpNoDelay);
-
- this.acceptor.start();
- this.advisor.handshake();
- this.loadMonitor.start(new ServerLocation(getExternalAddress(),
- getPort()), acceptor.getStats());
-
- // TODO : Need to provide facility to enable/disable client health monitoring.
- //Creating ClientHealthMonitoring region.
- // Force initialization on current cache
- if(cache instanceof GemFireCacheImpl) {
- ClientHealthMonitoringRegion.getInstance((GemFireCacheImpl)cache);
- }
- this.cache.getLoggerI18n().config(LocalizedStrings.BridgeServerImpl_CACHESERVER_CONFIGURATION___0, getConfig());
-
- /*
- * If the stopped bridge server is restarted, we'll need to re-register the
- * client membership listener. If the listener is already registered it
- * won't be registered as would the case when start() is invoked for the
- * first time.
- */
- BridgeMembershipListener[] membershipListeners =
- BridgeMembership.getBridgeMembershipListeners();
-
- boolean membershipListenerRegistered = false;
- for (BridgeMembershipListener membershipListener : membershipListeners) {
- //just checking by reference as the listener instance is final
- if (listener == membershipListener) {
- membershipListenerRegistered = true;
- break;
- }
- }
-
- if (!membershipListenerRegistered) {
- BridgeMembership.registerBridgeMembershipListener(listener);
- }
-
- if (!isGatewayReceiver) {
- InternalDistributedSystem system = ((GemFireCacheImpl) this.cache)
- .getDistributedSystem();
- system.handleResourceEvent(ResourceEvent.CACHE_SERVER_START, this);
- }
-
- }
-
-
- /**
- * Gets the address that this bridge server can be contacted on from external
- * processes.
- * @since 5.7
- */
- public String getExternalAddress() {
- return getExternalAddress(true);
- }
-
- public String getExternalAddress(boolean checkServerRunning) {
- if (checkServerRunning) {
- if (!this.isRunning()) {
- String s = "A bridge server's bind address is only available if it has been started";
- this.cache.getCancelCriterion().checkCancelInProgress(null);
- throw new IllegalStateException(s);
- }
- }
- if (this.hostnameForClients == null || this.hostnameForClients.equals("")) {
- if (this.acceptor != null) {
- return this.acceptor.getExternalAddress();
- }
- else {
- return null;
- }
- }
- else {
- return this.hostnameForClients;
- }
- }
-
- public boolean isRunning() {
- return this.acceptor != null && this.acceptor.isRunning();
- }
-
- public synchronized void stop() {
- if (!isRunning()) {
- return;
- }
-
- RuntimeException firstException = null;
-
- try {
- if(this.loadMonitor != null) {
- this.loadMonitor.stop();
- }
- } catch(RuntimeException e) {
- cache.getLoggerI18n().warning(LocalizedStrings.BridgeServerImpl_CACHESERVER_ERROR_CLOSING_LOAD_MONITOR, e);
- firstException = e;
- }
-
- try {
- if (this.advisor != null) {
- this.advisor.close();
- }
- } catch(RuntimeException e) {
- cache.getLoggerI18n().warning(LocalizedStrings.BridgeServerImpl_CACHESERVER_ERROR_CLOSING_ADVISOR, e);
- firstException = e;
- }
-
- try {
- if (this.acceptor != null) {
- this.acceptor.close();
- }
- } catch(RuntimeException e) {
- logger.warn(LocalizedMessage.create(LocalizedStrings.BridgeServerImpl_CACHESERVER_ERROR_CLOSING_ACCEPTOR_MONITOR), e);
- if (firstException != null) {
- firstException = e;
- }
- }
-
- if(firstException != null) {
- throw firstException;
- }
-
- //TODO : We need to clean up the admin region created for client
- //monitoring.
-
- // BridgeServer is still available, just not running, so we don't take
- // it out of the cache's list...
- // cache.removeBridgeServer(this);
-
- /* Assuming start won't be called after stop */
- BridgeMembership.unregisterBridgeMembershipListener(this.listener);
-
- TXManagerImpl txMgr = (TXManagerImpl) cache.getCacheTransactionManager();
- txMgr.removeHostedTXStatesForClients();
-
- if (!isGatewayReceiver) {
- InternalDistributedSystem system = ((GemFireCacheImpl) this.cache)
- .getDistributedSystem();
- system.handleResourceEvent(ResourceEvent.CACHE_SERVER_STOP, this);
- }
-
- }
-
- private String getConfig() {
- ClientSubscriptionConfig csc = this.getClientSubscriptionConfig();
- String str =
- "port=" + getPort() + " max-connections=" + getMaxConnections()
- + " max-threads=" + getMaxThreads() + " notify-by-subscription="
- + getNotifyBySubscription() + " socket-buffer-size="
- + getSocketBufferSize() + " maximum-time-between-pings="
- + getMaximumTimeBetweenPings() + " maximum-message-count="
- + getMaximumMessageCount() + " message-time-to-live="
- + getMessageTimeToLive() + " eviction-policy=" + csc.getEvictionPolicy()
- + " capacity=" + csc.getCapacity() + " overflow directory=";
- if (csc.getDiskStoreName() != null) {
- str += csc.getDiskStoreName();
- } else {
- str += csc.getOverflowDirectory();
- }
- str +=
- " groups=" + Arrays.asList(getGroups())
- + " loadProbe=" + loadProbe
- + " loadPollInterval=" + loadPollInterval
- + " tcpNoDelay=" + tcpNoDelay;
- return str;
- }
-
- @Override
- public String toString() {
- ClientSubscriptionConfig csc = this.getClientSubscriptionConfig();
- String str =
- "CacheServer on port=" + getPort() + " client subscription config policy="
- + csc.getEvictionPolicy() + " client subscription config capacity="
- + csc.getCapacity();
- if (csc.getDiskStoreName() != null) {
- str += " client subscription config overflow disk store="
- + csc.getDiskStoreName();
- } else {
- str += " client subscription config overflow directory="
- + csc.getOverflowDirectory();
- }
- return str;
- }
-
- /**
- * Test method used to access the internal acceptor
- *
- * @return the internal acceptor
- */
- public AcceptorImpl getAcceptor() {
- return this.acceptor;
- }
-
- // DistributionAdvisee methods
-
- public DM getDistributionManager() {
- return getSystem().getDistributionManager();
- }
-
- public ClientSession getClientSession(String durableClientId) {
- return getCacheClientNotifier().getClientProxy(durableClientId);
- }
-
- public ClientSession getClientSession(DistributedMember member) {
- return getCacheClientNotifier().getClientProxy(
- ClientProxyMembershipID.getClientId(member));
- }
-
- public Set getAllClientSessions() {
- return new HashSet(getCacheClientNotifier().getClientProxies());
- }
-
- /**
- * create client subscription
- *
- * @param cache
- * @param ePolicy
- * @param capacity
- * @param port
- * @param overFlowDir
- * @param isDiskStore
- * @return client subscription name
- * @since 5.7
- */
- public static String clientMessagesRegion(GemFireCacheImpl cache, String ePolicy,
- int capacity, int port, String overFlowDir, boolean isDiskStore) {
- AttributesFactory factory = getAttribFactoryForClientMessagesRegion(cache,
- ePolicy, capacity, overFlowDir, isDiskStore);
- RegionAttributes attr = factory.create();
-
- return createClientMessagesRegion(attr, cache, capacity, port);
- }
-
- public static AttributesFactory getAttribFactoryForClientMessagesRegion(
- GemFireCacheImpl cache,
- String ePolicy, int capacity, String overflowDir, boolean isDiskStore)
- throws InvalidValueException, GemFireIOException {
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
-
- if (isDiskStore) {
- // overflowDir parameter is actually diskstore name
- factory.setDiskStoreName(overflowDir);
- // client subscription queue is always overflow to disk, so do async
- // see feature request #41479
- factory.setDiskSynchronous(true);
- } else if (overflowDir == null || overflowDir.equals(ClientSubscriptionConfig.DEFAULT_OVERFLOW_DIRECTORY)) {
- factory.setDiskStoreName(null);
- // client subscription queue is always overflow to disk, so do async
- // see feature request #41479
- factory.setDiskSynchronous(true);
- } else {
- File dir = new File(overflowDir + File.separatorChar
- + generateNameForClientMsgsRegion(OSProcess.getId()));
- // This will delete the overflow directory when virtual machine terminates.
- dir.deleteOnExit();
- if (!dir.mkdirs() && !dir.isDirectory()) {
- throw new GemFireIOException("Could not create client subscription overflow directory: "
- + dir.getAbsolutePath());
- }
- File[] dirs = { dir };
- DiskStoreFactory dsf = cache.createDiskStoreFactory();
- DiskStore bsi = dsf.setAutoCompact(true)
- .setDiskDirsAndSizes(dirs, new int[] { Integer.MAX_VALUE })
- .create("bsi");
- factory.setDiskStoreName("bsi");
- // backward compatibility, it was sync
- factory.setDiskSynchronous(true);
- }
- factory.setDataPolicy(DataPolicy.NORMAL);
- // enable statistics
- factory.setStatisticsEnabled(true);
- /* setting LIFO related eviction attributes */
- if (HARegionQueue.HA_EVICTION_POLICY_ENTRY.equals(ePolicy)) {
- factory
- .setEvictionAttributes(EvictionAttributesImpl.createLIFOEntryAttributes(
- capacity, EvictionAction.OVERFLOW_TO_DISK));
- }
- else if (HARegionQueue.HA_EVICTION_POLICY_MEMORY.equals(ePolicy)) { // condition refinement
- factory
- .setEvictionAttributes(EvictionAttributesImpl.createLIFOMemoryAttributes(
- capacity, EvictionAction.OVERFLOW_TO_DISK));
- }
- else {
- // throw invalid eviction policy exception
- throw new InvalidValueException(
- LocalizedStrings.BridgeServerImpl__0_INVALID_EVICTION_POLICY.toLocalizedString(ePolicy));
- }
- return factory;
- }
-
- public static String createClientMessagesRegion(RegionAttributes attr,
- GemFireCacheImpl cache, int capacity, int port) {
- // generating unique name in VM for ClientMessagesRegion
- String regionName = generateNameForClientMsgsRegion(port);
- try {
- cache.createVMRegion(regionName, attr,
- new InternalRegionArguments().setDestroyLockFlag(true)
- .setRecreateFlag(false).setSnapshotInputStream(null)
- .setImageTarget(null).setIsUsedForMetaRegion(true));
- }
- catch (RegionExistsException ree) {
- InternalGemFireError assErr = new InternalGemFireError(
- "unexpected exception");
- assErr.initCause(ree);
- throw assErr;
- }
- catch (IOException e) {
- // only if loading snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- "unexpected exception");
- assErr.initCause(e);
- throw assErr;
- }
- catch (ClassNotFoundException e) {
- // only if loading snapshot, not here
- InternalGemFireError assErr = new InternalGemFireError(
- "unexpected exception");
- assErr.initCause(e);
- throw assErr;
- }
- return regionName;
- }
-
- public static String createClientMessagesRegionForTesting(GemFireCacheImpl cache,
- String ePolicy, int capacity, int port, int expiryTime, String overFlowDir, boolean isDiskStore) {
- AttributesFactory factory = getAttribFactoryForClientMessagesRegion(cache,
- ePolicy, capacity, overFlowDir, isDiskStore);
- ExpirationAttributes ea = new ExpirationAttributes(expiryTime,
- ExpirationAction.LOCAL_INVALIDATE);
- factory.setEntryTimeToLive(ea);
- RegionAttributes attr = factory.create();
-
- return createClientMessagesRegion(attr, cache, capacity, port);
- }
-
- /**
- * Generates the name for the client subscription using the given id.
- *
- * @param id
- * @return String
- * @since 5.7
- */
- public static String generateNameForClientMsgsRegion(int id) {
- return ClientSubscriptionConfigImpl.CLIENT_SUBSCRIPTION + "_" + id;
- }
-
- /*
- * Marker class name to identify the lock more easily in thread dumps private
- * static class ClientMessagesRegionLock extends Object { }
- */
- public DistributionAdvisor getDistributionAdvisor() {
- return this.advisor;
- }
-
- /**
- * Returns the BridgeServerAdvisor for this server
- */
- public BridgeServerAdvisor getCacheServerAdvisor() {
- return this.advisor;
- }
-
- public Profile getProfile() {
- return getDistributionAdvisor().createProfile();
- }
-
- public DistributionAdvisee getParentAdvisee() {
- return null;
- }
-
- /**
- * Returns the underlying <code>InternalDistributedSystem</code> connection.
- * @return the underlying <code>InternalDistributedSystem</code>
- */
- public InternalDistributedSystem getSystem() {
- return (InternalDistributedSystem)this.cache.getDistributedSystem();
- }
-
- public String getName() {
- return "CacheServer";
- }
-
- public String getFullPath() {
- return getName();
- }
-
- private final static AtomicInteger profileSN = new AtomicInteger();
-
- private static int createSerialNumber() {
- return profileSN.incrementAndGet();
- }
-
- /**
- * Returns an array of all the groups of this bridge server.
- * This includes those from the groups gemfire property
- * and those explicitly added to this server.
- */
- public String[] getCombinedGroups() {
- ArrayList<String> groupList = new ArrayList<String>();
- for (String g: MemberAttributes.parseGroups(null, getSystem().getConfig().getGroups())) {
- if (!groupList.contains(g)) {
- groupList.add(g);
- }
- }
- for (String g: getGroups()) {
- if (!groupList.contains(g)) {
- groupList.add(g);
- }
- }
- String[] groups = new String[groupList.size()];
- return groupList.toArray(groups);
- }
-
- public /*synchronized causes deadlock*/ void fillInProfile(Profile profile) {
- assert profile instanceof BridgeServerProfile;
- BridgeServerProfile bp = (BridgeServerProfile)profile;
- bp.setHost(getExternalAddress(false));
- bp.setPort(getPort());
- bp.setGroups(getCombinedGroups());
- bp.setMaxConnections(maxConnections);
- bp.setInitialLoad(loadMonitor.getLastLoad());
- bp.setLoadPollInterval(getLoadPollInterval());
- bp.serialNumber = getSerialNumber();
- bp.finishInit();
- }
-
- public int getSerialNumber() {
- return this.serialNumber;
- }
-
-
- protected CacheClientNotifier getCacheClientNotifier() {
- return getAcceptor().getCacheClientNotifier();
- }
-
- /**
- * Registers a new <code>InterestRegistrationListener</code> with the set of
- * <code>InterestRegistrationListener</code>s.
- *
- * @param listener
- * The <code>InterestRegistrationListener</code> to register
- * @throws IllegalStateException if the BridgeServer has not been started
- * @since 5.8Beta
- */
- public void registerInterestRegistrationListener(
- InterestRegistrationListener listener) {
- if (!this.isRunning()) {
- throw new IllegalStateException(LocalizedStrings.BridgeServerImpl_MUST_BE_RUNNING.toLocalizedString());
- }
- getCacheClientNotifier().registerInterestRegistrationListener(listener);
- }
-
- /**
- * Unregisters an existing <code>InterestRegistrationListener</code> from
- * the set of <code>InterestRegistrationListener</code>s.
- *
- * @param listener
- * The <code>InterestRegistrationListener</code> to
- * unregister
- *
- * @since 5.8Beta
- */
- public void unregisterInterestRegistrationListener(
- InterestRegistrationListener listener) {
- getCacheClientNotifier().unregisterInterestRegistrationListener(listener);
- }
-
- /**
- * Returns a read-only set of <code>InterestRegistrationListener</code>s
- * registered with this notifier.
- *
- * @return a read-only set of <code>InterestRegistrationListener</code>s
- * registered with this notifier
- *
- * @since 5.8Beta
- */
- public Set getInterestRegistrationListeners() {
- return getCacheClientNotifier().getInterestRegistrationListeners();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java
index 1299d75..ec75a92 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java
@@ -1789,7 +1789,7 @@ public final class BucketAdvisor extends CacheDistributionAdvisor {
HashSet<BucketServerLocation66> serverLocations = new HashSet<BucketServerLocation66>();
for (Object object : servers) {
- BridgeServerImpl server = (BridgeServerImpl)object;
+ CacheServerImpl server = (CacheServerImpl)object;
if (server.isRunning() && (server.getExternalAddress() != null)) {
BucketServerLocation66 location = new BucketServerLocation66(
getBucket().getId(), server.getPort(), server
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheConfig.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheConfig.java
index 7aaa241..4c29879 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheConfig.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheConfig.java
@@ -9,7 +9,7 @@ package com.gemstone.gemfire.internal.cache;
import java.util.List;
-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.pdx.PdxSerializer;
import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
@@ -40,7 +40,7 @@ public class CacheConfig {
/**
* list of cache servers to create after auto-reconnect if cluster configuration is being used
*/
- private List<BridgeServerCreation> cacheServerCreation;
+ private List<CacheServerCreation> cacheServerCreation;
/**
* This indicates if the pdxReadSerialized value is set by user. This is used
@@ -137,12 +137,12 @@ public class CacheConfig {
}
- public List<BridgeServerCreation> getCacheServerCreation() {
+ public List<CacheServerCreation> getCacheServerCreation() {
return this.cacheServerCreation;
}
- public void setCacheServerCreation(List<BridgeServerCreation> servers) {
+ public void setCacheServerCreation(List<CacheServerCreation> servers) {
this.cacheServerCreation = servers;
}