GemFire 5.5.1

com.gemstone.gemfire.cache.util
Interface GatewayHub


public interface GatewayHub

A GatewayHub manages a collection of Gateways.

Since:
4.2
See Also:
Gateway

Field Summary
static int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS
          The default maximum amount of time between client pings.
static int DEFAULT_SOCKET_BUFFER_SIZE
          The default buffer size 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.
 Object getAllGatewaysLock()
          Return a mutex to lock when iterating over the list of gateways
 Cache getCache()
          Returns this GatewayHub's GemFire cache
 List getGatewayIds()
          Returns the ids of this GatewayHub's list of known Gateways
 List getGateways()
          Returns this GatewayHub's list of known Gateways
 String getId()
          Returns the identifier of 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()
          Returns whether this GatewayHub is running
 void removeGateway(String id)
          Removes a Gateway from this GatewayHub.
 void setId(String id)
          Sets the identifier 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 requested.
 void startGateways()
          Notifies all of this GatewayHub's Gateways to start.
 void stop()
          Stops this GatewayHub by stopping its listener and notifying each of its Gateways to stop.
 void stopGateways()
          Notifies all of this GatewayHub's Gateways to stop.
 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 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 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
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. Once the hub 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 requested. Once the hub is running, its configuration cannot be changed.

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

startGateways

void startGateways()
                   throws IOException
Notifies all of this GatewayHub's Gateways to start.

Throws:
IOException

stopGateways

void stopGateways()
Notifies all of this GatewayHub's Gateways to stop.


isRunning

boolean isRunning()
Returns whether this GatewayHub is running


stop

void stop()
Stops this GatewayHub by stopping its listener and notifying each of its Gateways to stop. Note that the GatewayHub can be reconfigured and restarted if desired.


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

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 getGateways()
Returns this GatewayHub's list of known Gateways

Returns:
this GatewayHub's list of known Gateways

getGatewayIds

List 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
Note: Early Access. Please consult GemStone technical support for assistance with this functionality.

getStartupPolicy

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

Returns:
the startup policy for this GatewayHub
Since:
5.1
Note: Early Access. Please consult GemStone technical support for assistance with this functionality.

getAllGatewaysLock

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

Returns:
the mutex to synchronize with

GemFire 5.5.1

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.