All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.util.BridgeServer Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */
package com.gemstone.gemfire.cache.util;

import java.io.IOException;
import java.util.Set;

import com.gemstone.gemfire.cache.ClientSession;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.cache.client.Pool;
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.ConnectionCountProbe;

/**
 * A cache bridge server that serves the contents of a
 * Cache to VMs in another distributed system via a
 * socket.  A bridge server is used in conjunction with a
 * client {@link Pool} to connect two regions
 * that reside in different distributed systems.
 *
 * @see com.gemstone.gemfire.cache.Cache#addBridgeServer
 * @see com.gemstone.gemfire.cache.Cache#getBridgeServers
 *
 * @since 2.0.2
 * @deprecated as of 5.7 used {@link CacheServer} instead.
 */
@Deprecated
public interface BridgeServer {

  /** The default port on which a BridgeServer is
   * configured to serve. */
  public static final int DEFAULT_PORT = 40404;

  /** 
   * The default number of sockets accepted by a BridgeServer. 
   * When the maximum is reached the server will stop accepting new connections.
   * Current value: 800
   * @since 5.7
   */
  public static final int DEFAULT_MAX_CONNECTIONS = 800;
  // Value derived from common file descriptor limits for Unix sytems (1024)... 

  /** 
   * The default limit to the maximum number of server threads that can be
   * created to service client requests. Once this number of threads exist then
   * connections must share the same thread to service their request. A selector
   * is used to detect client connection requests and dispatch them to the thread
   * pool.
   * The default of 0 causes a thread to be bound to every connection
   * and to be dedicated to detecting client requests on that connection. A selector
   * is not used in this default mode.
   * Current value: 0
   * @since 5.7
   */
  public static final int DEFAULT_MAX_THREADS = 0;

  /** The default notify-by-subscription value which tells the
   * BridgeServer whether or not to notify clients
   * based on key subscription. */
  public static final boolean DEFAULT_NOTIFY_BY_SUBSCRIPTION = true;

  /**
   * The default socket buffer size for socket buffers from the server
   * to the client.
   */
  public static final int DEFAULT_SOCKET_BUFFER_SIZE = 32768;

  /**
   * The default maximum amount of time between client pings. This value
   * is used by the ClientHealthMonitor to determine the
   * health of this BridgeServer's clients.
   */
  public static final int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS = 60000;

  /**
   * The default maximum number of messages that can be enqueued in a
   * client-queue.
   */
  public static final int DEFAULT_MAXIMUM_MESSAGE_COUNT = 230000;

  /**
   * The default time (in seconds ) after which a message in the client queue
   * will expire.
   */
  public static final int DEFAULT_MESSAGE_TIME_TO_LIVE = 180;

  /**
   * The default list of server groups a server belongs to.
   * The current default is an empty list.
   * @since 5.7
   */
  public static final String[] DEFAULT_GROUPS = new String[0];
  
  /**
   * The default load balancing probe. The default load balancing
   * probe reports the connections counts of this server. 
   * @since 5.7
   *  
   */
  public static final ServerLoadProbe DEFAULT_LOAD_PROBE = new ConnectionCountProbe();
  
  /**
   * The default frequency at which to poll the load probe for the load
   * on this server. Defaults to 5000 (5 seconds).
   * @since 5.7
   */
  public static final long DEFAULT_LOAD_POLL_INTERVAL = 5000;

  /**
   * The default ip address or host name that the server's socket will
   * listen on for client connections.
   * The current default is an empty string.
   * @since 5.7
   */
  public static final String DEFAULT_BIND_ADDRESS = "";

  /**
   * The default ip address or host name that will be given to clients
   * as the host this server is listening on.
   * The current default is an empty string.
   * @since 5.7
   */
  public static final String DEFAULT_HOSTNAME_FOR_CLIENTS = "";

  /**
   * Returns the port on which this server listens for clients.
   */
  public int getPort();

  /**
   * Sets the port on which this server listens for clients.
   *
   * @throws IllegalStateException
   *         If this server is running
   */
  public void setPort(int port);

  /**
   * Returns a string representing the ip address or host name that this server
   * will listen on.
   * @return the ip address or host name that this server is to listen on
   * @see #DEFAULT_BIND_ADDRESS
   * @since 5.7
   */
  public String getBindAddress();
  /**
   * Sets the ip address or host name that this server is to listen on for
   * client connections.
   * 

Setting a specific bind address will cause the server to always * use this address and ignore any address specified by "server-bind-address" * or "bind-address" in the gemfire.properties file * (see {@link com.gemstone.gemfire.distributed.DistributedSystem} * for a description of these properties). *

The value "" does not override the gemfire.properties. * It will cause the local machine's default address to be listened on if the * properties file does not specify and address. * If you wish to override the properties and want to have your server bind to all local * addresses then use this bind address "0.0.0.0". *

A null value will be treated the same as the default "". * @param address the ip address or host name that this server is to listen on * @see #DEFAULT_BIND_ADDRESS * @since 5.7 */ public void setBindAddress(String address); /** * Returns a string representing the ip address or host name that server locators * will tell clients that this server is listening on. * @return the ip address or host name to give to clients so they can connect * to this server * @see #DEFAULT_HOSTNAME_FOR_CLIENTS * @since 5.7 */ public String getHostnameForClients(); /** * Sets the ip address or host name that this server is to listen on for * client connections. *

Setting a specific hostname-for-clients will cause server locators * to use this value when telling clients how to connect to this server. * This is useful in the case where the server may refer to itself with one * hostname, but the clients need to use a different hostname to find the * server. *

The value "" causes the bind-address to be given to clients. *

A null value will be treated the same as the default "". * @param name the ip address or host name that will be given to clients * so they can connect to this server * @see #DEFAULT_HOSTNAME_FOR_CLIENTS * @since 5.7 */ public void setHostnameForClients(String name); /** * Sets whether or not this server should notify clients based on * key subscription. * * If false, then an update to any key on the server causes an update to * be sent to all clients. This update does not push the actual data to the * clients. Instead, it causes the client to locally invalidate or destroy * the corresponding entry. The next time the client requests the key, it * goes to the server for the value. * * If true, then an update to any key on the server causes an update to be * sent to only those clients who have registered interest in that key. Other * clients are not notified of the change. In addition, the actual value is * pushed to the client. The client does not need to request the new value * from the server. * * @since 4.2 * @deprecated as of 6.0.1. This method is no more in use, by default * notifyBySubscription attribute is set to true. */ @Deprecated public void setNotifyBySubscription(boolean b); /** * Answers whether or not this server should notify clients based on * key subscription. * * @since 4.2 * @deprecated as of 6.0.1. This method is no more in use, by default * notifyBySubscription attribute is set to true. */ @Deprecated public boolean getNotifyBySubscription(); /** * Sets the buffer size in bytes of the socket connection for this * BridgeServer. The default is 32768 bytes. * * @param socketBufferSize The size in bytes of the socket buffer * * @since 4.2.1 */ public void setSocketBufferSize(int socketBufferSize); /** * Returns the configured buffer size of the socket connection for this * BridgeServer. The default is 32768 bytes. * @return the configured buffer size of the socket connection for this * BridgeServer * * @since 4.2.1 */ public int getSocketBufferSize(); /** * Sets the maximum amount of time between client pings. This value is * used by the ClientHealthMonitor to determine the health * of this BridgeServer's clients. The default is 60000 ms. * * @param maximumTimeBetweenPings The maximum amount of time between client * pings * * @since 4.2.3 */ public void setMaximumTimeBetweenPings(int maximumTimeBetweenPings); /** * Returns the maximum amount of time between client pings. This value is * used by the ClientHealthMonitor to determine the health * of this BridgeServer's clients. The default is 60000 ms. * @return the maximum amount of time between client pings. * * @since 4.2.3 */ public int getMaximumTimeBetweenPings(); /** * Starts this server. Once the server is running, its * configuration cannot be changed. * * @throws IOException * If an error occurs while starting the server */ public void start() throws IOException; /** * Returns whether or not this server is running */ public boolean isRunning(); /** * Stops this server. Note that the * BridgeServer can be reconfigured and restarted if * desired. */ public void stop(); /** * Returns the maximum allowed client connections */ public int getMaxConnections(); /** * Sets the maxium number of client connections allowed. * When the maximum is reached the server will stop accepting * connections. * * @see #DEFAULT_MAX_CONNECTIONS */ public void setMaxConnections(int maxCons); /** * Returns the maxium number of threads allowed in this server to service * client requests. * The default of 0 causes the server to dedicate a thread for * every client connection. * @since 5.1 */ public int getMaxThreads(); /** * Sets the maxium number of threads allowed in this server to service * client requests. * The default of 0 causes the server to dedicate a thread for * every client connection. * * @see #DEFAULT_MAX_THREADS * @since 5.1 */ public void setMaxThreads(int maxThreads); /** * Returns the maximum number of messages that can be enqueued in a * client-queue. */ public int getMaximumMessageCount(); /** * Sets maximum number of messages that can be enqueued in a client-queue. * * @see #DEFAULT_MAXIMUM_MESSAGE_COUNT */ public void setMaximumMessageCount(int maxMessageCount); /** * Returns the time (in seconds ) after which a message in the client queue * will expire. */ public int getMessageTimeToLive(); /** * Sets the time (in seconds ) after which a message in the client queue * will expire.Expiry settings are applicable for the secondary queues only * This setting has no impact on the primary queue. * * @see #DEFAULT_MESSAGE_TIME_TO_LIVE */ public void setMessageTimeToLive(int messageTimeToLive); /** * Returns the ClientSession associated with the * DistributedMember * @return the ClientSession associated with the * DistributedMember * @since 5.6 */ public ClientSession getClientSession(DistributedMember member); /** * Returns the ClientSession associated with the * durable client id * @return the ClientSession associated with the * durable * @since 5.6 */ public ClientSession getClientSession(String durableClientId); /** * Returns a set of all ClientSessions * @return a set of all ClientSessions */ public Set getAllClientSessions(); /** * Sets the list of server groups this cache server will belong to. * By default cache servers belong to the default global server group * which all cache servers always belong to. * @param groups possibly empty array of String where each string * is a server groups that this cache server will be a member of. * @see #DEFAULT_GROUPS * @since 5.7 */ public void setGroups(String[] groups); /** * Returns the list of server groups that this cache server belongs to. * @return a possibly empty array of Strings where * each string is a server group. Modifying this array will not change the * server groups that this cache server belongs to. * @since 5.7 */ public String[] getGroups(); /** * Get the load probe for this cache server. See * {@link ServerLoadProbe} for details on the load probe. * @return the load probe used by this cache * server. * @since 5.7 */ public ServerLoadProbe getLoadProbe(); /** * Set the load probe for this cache server. See * {@link ServerLoadProbe} for details on how to implement * a load probe. * @param loadProbe the load probe to use for * this cache server. * @since 5.7 */ public void setLoadProbe(ServerLoadProbe loadProbe); /** * Get the frequency in milliseconds to poll the load probe on this cache * server. * * @return the frequency in milliseconds that we will poll the load probe. */ public long getLoadPollInterval(); /** * Set the frequency in milliseconds to poll the load probe on this cache * server * @param loadPollInterval the frequency in milliseconds to poll * the load probe. Must be greater than 0. */ public void setLoadPollInterval(long loadPollInterval); /** * Get the ClientSubscriptionConfig for this cache server. See * {@link ClientSubscriptionConfig} for details on the client subscription configuration. * * @return ClientSubscriptionConfig * @since 5.7 */ public ClientSubscriptionConfig getClientSubscriptionConfig(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy