GemFire 6.6.2

com.gemstone.gemfire.cache.util
Interface GatewayHub


public interface GatewayHub

A GatewayHub manages a collection of Gateways. It has three primary purposes, namely:

Since:
4.2
See Also:
Gateway, GatewayEvent, GatewayEventListener

Field Summary
static String DEFAULT_BIND_ADDRESS
          The default ip address or host name that this GatewayHub's socket will listen on for connections.
static boolean DEFAULT_MANUAL_START
          The default value (false) for manually starting a GatewayHub.
static int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS
          The default maximum amount of time (60000 ms) between client pings.
static int DEFAULT_PORT
          The default value (-1) for this GatewayHub's port.
static int DEFAULT_SOCKET_BUFFER_SIZE
          The default buffer size (32768 bytes) for socket buffers from a sending GatewayHub to the receiving one.
static String DEFAULT_STARTUP_POLICY
          The default startup policy (STARTUP_POLICY_NONE).
static String STARTUP_POLICY_NONE
          The 'none' startup policy.
static String STARTUP_POLICY_PRIMARY
          The 'primary' startup policy.
static String STARTUP_POLICY_SECONDARY
          The 'secondary' startup policy.
static int STARTUP_POLICY_SECONDARY_WAIT
          The amount of time in milliseconds a GatewayHub defined with secondary startup policy waits for a primary GatewayHub to start before logging a warning and becoming the primary GatewayHub itself.
 
Method Summary
 Gateway addGateway(String id)
          Adds a Gateway to this GatewayHub's known Gateways.
 Gateway addGateway(String id, int concurrencyLevel)
          Adds a Gateway to this GatewayHub's known Gateways.
 Object getAllGatewaysLock()
          Return a mutex to lock when iterating over the list of gateways
 String getBindAddress()
          Returns a string representing the ip address or host name that this GatewayHub will listen on.
 Cache getCache()
          Returns this GatewayHub's GemFire cache
 CancelCriterion getCancelCriterion()
          Returns the CancelCriterion for this GatewayHub.
 List<String> getGatewayIds()
          Returns the ids of this GatewayHub's list of known Gateways
 List<Gateway> getGateways()
          Returns this GatewayHub's list of known Gateways
 String getId()
          Returns the identifier of this GatewayHub
 boolean getManualStart()
          Returns the manual start boolean property for this GatewayHub.
 int getMaximumTimeBetweenPings()
          Returns the maximum amount of time between client pings.
 int getPort()
          Returns the port on which this GatewayHub listens for remote connections
 int getSocketBufferSize()
          Returns the configured buffer size of the socket connection for this GatewayHub.
 String getStartupPolicy()
          Returns the startup policy for this GatewayHub.
 boolean isPrimary()
          Returns whether this GatewayHub is the primary hub.
 boolean isRunning()
          Deprecated. use getCancelCriterion().cancelInProgress() instead
 void pauseGateways()
          Notifies all of this GatewayHub's Gateways to pause sending events.
 void removeGateway(String id)
          Removes a Gateway from this GatewayHub.
 void resumeGateways()
          Notifies all of this GatewayHub's Gateways to resume sending events.
 void setBindAddress(String address)
          Sets the ip address or host name that this GatewayHub will listen on for connections.
 void setId(String id)
          Sets the identifier for this GatewayHub
 void setManualStart(boolean manualStart)
          Sets the manual start boolean property for this GatewayHub.
 void setMaximumTimeBetweenPings(int maximumTimeBetweenPings)
          Sets the maximum amount of time between client pings.
 void setPort(int port)
          Sets the port on which this GatewayHub listens for remote connections
 void setSocketBufferSize(int socketBufferSize)
          Sets the buffer size in bytes of the socket connection for this GatewayHub.
 void setStartupPolicy(String startupPolicy)
          Sets the startup policy for this GatewayHub.
 void start()
          Starts this GatewayHub and notifies all of its Gateways to start.
 void start(boolean startGateways)
          Starts this GatewayHub and notifies all of its Gateways to start if startGateways is true.
 void startGateways()
          Starts all of this GatewayHub's Gateways.
 void stop()
          Stops this GatewayHub.
 void stopGateways()
          Stops all of this GatewayHub's Gateways.
 String toDetailedString()
          Returns detailed string representation of this GatewayHub.
 

Field Detail

DEFAULT_SOCKET_BUFFER_SIZE

static final int DEFAULT_SOCKET_BUFFER_SIZE
The default buffer size (32768 bytes) for socket buffers from a sending GatewayHub to the receiving one.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS

static final int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS
The default maximum amount of time (60000 ms) between client pings. This value is used by the ClientHealthMonitor to determine the health of this GatewayHub's clients.

See Also:
Constant Field Values

STARTUP_POLICY_NONE

static final String STARTUP_POLICY_NONE
The 'none' startup policy. This setting (the default) means that the VM will attempt to become the primary GatewayHub. If it can become the primary GatewayHub, it will. If not, then it will become a secondary GatewayHub.

See Also:
Constant Field Values

STARTUP_POLICY_PRIMARY

static final String STARTUP_POLICY_PRIMARY
The 'primary' startup policy. This setting means that the VM will attempt to become the primary GatewayHub. If it can become the primary GatewayHub, it will. If not, then it will log a warning and become a secondary GatewayHub.

See Also:
Constant Field Values

STARTUP_POLICY_SECONDARY

static final String STARTUP_POLICY_SECONDARY
The 'secondary' startup policy. This setting means that the VM will wait for STARTUP_POLICY_SECONDARY_WAIT milliseconds for another VM to start as the primary GatewayHub. If another VM does start as the primary GatewayHub within STARTUP_POLICY_SECONDARY_WAIT milliseconds, then this VM will start as a secondary GatewayHub. If not, then it will log a warning and start as the primary GatewayHub.

See Also:
Constant Field Values

DEFAULT_STARTUP_POLICY

static final String DEFAULT_STARTUP_POLICY
The default startup policy (STARTUP_POLICY_NONE).

See Also:
Constant Field Values

STARTUP_POLICY_SECONDARY_WAIT

static final int STARTUP_POLICY_SECONDARY_WAIT
The amount of time in milliseconds a GatewayHub defined with secondary startup policy waits for a primary GatewayHub to start before logging a warning and becoming the primary GatewayHub itself. This value is 60000 milliseconds.

See Also:
Constant Field Values

DEFAULT_MANUAL_START

static final boolean DEFAULT_MANUAL_START
The default value (false) for manually starting a GatewayHub.

Since:
5.7
See Also:
Constant Field Values

DEFAULT_PORT

static final int DEFAULT_PORT
The default value (-1) for this GatewayHub's port. This is not a valid port for creating connections and should only be used in cases in which the GatewayHub does not accept any connections, such as database write behind applications.

Since:
5.7
See Also:
Constant Field Values

DEFAULT_BIND_ADDRESS

static final String DEFAULT_BIND_ADDRESS
The default ip address or host name that this GatewayHub's socket will listen on for connections. The current default is null.

Since:
6.5.1
Method Detail

getPort

int getPort()
Returns the port on which this GatewayHub listens for remote connections

Returns:
the port on which this GatewayHub listens for remote connections

setPort

void setPort(int port)
Sets the port on which this GatewayHub listens for remote connections

Parameters:
port - The port on which this GatewayHub listens for remote connections

setId

void setId(String id)
Sets the identifier for this GatewayHub

Parameters:
id - The identifier for this GatewayHub

getId

String getId()
Returns the identifier of this GatewayHub

Returns:
the identifier of this GatewayHub

setSocketBufferSize

void setSocketBufferSize(int socketBufferSize)
Sets the buffer size in bytes of the socket connection for this GatewayHub. The default is 32768 bytes.

Parameters:
socketBufferSize - The size in bytes of the socket buffer
Since:
4.2.1

getSocketBufferSize

int getSocketBufferSize()
Returns the configured buffer size of the socket connection for this GatewayHub. The default is 32768 bytes.

Returns:
the configured buffer size of the socket connection for this GatewayHub
Since:
4.2.1

setMaximumTimeBetweenPings

void setMaximumTimeBetweenPings(int maximumTimeBetweenPings)
Sets the maximum amount of time between client pings. This value is used by the ClientHealthMonitor to determine the health of any foreign Gateways connected to this GatewayHub. The default is 60000 ms.

Parameters:
maximumTimeBetweenPings - The maximum amount of time between client pings
Since:
4.2.3

getMaximumTimeBetweenPings

int getMaximumTimeBetweenPings()
Returns the maximum amount of time between client pings. This value is used by the ClientHealthMonitor to determine the health of any foreign Gateways connected to this GatewayHub. The default is 60000 ms.

Returns:
the maximum amount of time between client pings.
Since:
4.2.3

start

void start()
           throws IOException
Starts this GatewayHub and notifies all of its Gateways to start. Starting a GatewayHub does several actions, including: Once the GatewayHub is running, its configuration cannot be changed.

Throws:
IOException - If an error occurs while starting the GatewayHub

start

void start(boolean startGateways)
           throws IOException
Starts this GatewayHub and notifies all of its Gateways to start if startGateways is true. Starting a GatewayHub does several actions, including: Once the GatewayHub is running, its configuration cannot be changed.

Parameters:
startGateways - Whether to notify the Gateways to start
Throws:
IOException

startGateways

void startGateways()
                   throws IOException
Starts all of this GatewayHub's Gateways. This can be used to start Gateways that have been stopped using stopGateways() or not started when this GatewayHub is started.

Throws:
IOException

stopGateways

void stopGateways()
Stops all of this GatewayHub's Gateways. Stopping the Gateways will cause this GatewayHub to act just as a receiver of remote GatewayEvents. It will neither send nor queue local events for remote delivery. Stopping Gateways is useful when updates to the local site should not be sent to the remote sites (e.g. during an initial load). This action has no effect on this GatewayHub's primary/secondary status.


isRunning

@Deprecated
boolean isRunning()
Deprecated. use getCancelCriterion().cancelInProgress() instead

Returns whether this GatewayHub is running

Returns:
whether this GatewayHub is running

stop

void stop()
Stops this GatewayHub. Stopping a GatewayHub does several actions, including: Note that the GatewayHub can be reconfigured and restarted if desired. In this case, the GatewayHub will restart as secondary if another GatewayHub is already running in the local site.


getCache

Cache getCache()
Returns this GatewayHub's GemFire cache

Returns:
this GatewayHub's GemFire cache

addGateway

Gateway addGateway(String id)
                   throws GatewayException
Adds a Gateway to this GatewayHub's known Gateways.

Parameters:
id - The id of the Gateway
Returns:
the added Gateway
Throws:
GatewayException - if this GatewayHub already defines a Gateway with this id

addGateway

Gateway addGateway(String id,
                   int concurrencyLevel)
                   throws GatewayException
Adds a Gateway to this GatewayHub's known Gateways.

Parameters:
id - The id of the Gateway
concurrencyLevel - The concurrency level (number of parallel threads) processing GatewayEvents *
Returns:
the added Gateway
Throws:
GatewayException - if this GatewayHub already defines a Gateway with this id
Since:
6.5.1

removeGateway

void removeGateway(String id)
                   throws GatewayException
Removes a Gateway from this GatewayHub.

Parameters:
id - The id of the Gateway
Throws:
GatewayException - if this GatewayHub does not contain a Gateway with this id

getGateways

List<Gateway> getGateways()
Returns this GatewayHub's list of known Gateways

Returns:
this GatewayHub's list of known Gateways

getGatewayIds

List<String> getGatewayIds()
Returns the ids of this GatewayHub's list of known Gateways

Returns:
the ids of this GatewayHub's list of known Gateways

isPrimary

boolean isPrimary()
Returns whether this GatewayHub is the primary hub.

Returns:
whether this GatewayHub is the primary hub

toDetailedString

String toDetailedString()
Returns detailed string representation of this GatewayHub.

Returns:
detailed string representation of this GatewayHub

setStartupPolicy

void setStartupPolicy(String startupPolicy)
                      throws GatewayException
Sets the startup policy for this GatewayHub.

Parameters:
startupPolicy - the startup policy for this GatewayHub
Throws:
GatewayException - if the input startup policy is not valid.
Since:
5.1

getStartupPolicy

String getStartupPolicy()
Returns the startup policy for this GatewayHub.

Returns:
the startup policy for this GatewayHub
Since:
5.1

getAllGatewaysLock

Object getAllGatewaysLock()
Return a mutex to lock when iterating over the list of gateways

Returns:
the mutex to synchronize with

setManualStart

void setManualStart(boolean manualStart)
Sets the manual start boolean property for this GatewayHub. This property is mainly used for controlling when a GatewayHub configured in xml is started. By default, a GatewayHub is started right after the Regions are created. Setting this to true allows the application to start a GatewayHub when desired (e.g. after all remote Regions are created and initialized).

Parameters:
manualStart - the manual start boolean property for this GatewayHub
Since:
5.7

getManualStart

boolean getManualStart()
Returns the manual start boolean property for this GatewayHub.

Returns:
the manual start boolean property for this GatewayHub
Since:
5.7

getCancelCriterion

CancelCriterion getCancelCriterion()
Returns the CancelCriterion for this GatewayHub.

Returns:
the CancelCriterion for this GatewayHub
Since:
6.0

pauseGateways

void pauseGateways()
Notifies all of this GatewayHub's Gateways to pause sending events. Events will continue to be queued while the Gateway is paused. Pausing a Gateway only affects outgoing events. It has no affect on incoming ones. It also has no effect on the primary status of this GatewayHub.

Since:
6.0

resumeGateways

void resumeGateways()
Notifies all of this GatewayHub's Gateways to resume sending events. Processing the queue will resume when a Gateway is resumed.

Since:
6.0

getBindAddress

String getBindAddress()
Returns a string representing the ip address or host name that this GatewayHub will listen on.

Returns:
the ip address or host name that this GatewayHub will listen on
Since:
6.5.1
See Also:
DEFAULT_BIND_ADDRESS

setBindAddress

void setBindAddress(String address)
Sets the ip address or host name that this GatewayHub will listen on for connections.

Setting a specific bind address will cause the GatewayHub to always use this address and ignore any address specified by "server-bind-address" or "bind-address" in the gemfire.properties file (see 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 GatewayHub 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 "".

Parameters:
address - the ip address or host name that this GatewayHub will listen on
Since:
6.5.1
See Also:
DEFAULT_BIND_ADDRESS

GemFire 6.6.2

Copyright © 1997-2012 VMware, Inc. All rights reserved.