com.streamhub.client
Class FailoverParameters

java.lang.Object
  extended by com.streamhub.client.FailoverParameters

public class FailoverParameters
extends Object

The failover parameters for a connection to StreamHub.

See Also:
StreamHubGWTAdapter.connect(FailoverParameters)

Constructor Summary
FailoverParameters(List<String> servers)
          Creates a new FailoverParameters object
 
Method Summary
 FailoverAlgorithm getAlgorithm()
          Gets the FailoverAlgorithm
 double getBackOffMultiplier()
          Gets the multiplier used when exponential backoff is enabled via setUseExponentialBackOff(boolean).
 long getInitialReconnectDelayMillis()
          Gets the initial time in milliseconds to wait before attempting reconnection
 int getMaxReconnectAttempts()
          Gets the maximum number of failed reconnection attempts before giving up.
 long getMaxReconnectDelayMillis()
          Gets the maximum amount of time in milliseconds to wait between reconnection attempts.
 List<String> getServers()
          Gets the list of server URLs to connect to
 boolean isUseExponentialBackOff()
          Returns true if exponential backoff is enabled, false otherwise.
 void setAlgorithm(FailoverAlgorithm algorithm)
          Sets the FailoverAlgorithm
 void setBackOffMultiplier(double backOffMultiplier)
          Sets the multiplier used when exponential backoff is enabled via setUseExponentialBackOff(boolean).
 void setInitialReconnectDelayMillis(long initialReconnectDelayMillis)
          Sets the initial time in milliseconds to wait before attempting reconnection
 void setMaxReconnectAttempts(int maxReconnectAttempts)
          Sets the maximum number of failed reconnection attempts before giving up.
 void setMaxReconnectDelayMillis(long maxReconnectDelayMillis)
          Sets the maximum amount of time in milliseconds to wait between reconnection attempts.
 void setUseExponentialBackOff(boolean useExponentialBackOff)
          Enables or disables exponential backoff.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailoverParameters

public FailoverParameters(List<String> servers)
Creates a new FailoverParameters object

Parameters:
servers - A list of servers to connect to
Method Detail

getAlgorithm

public FailoverAlgorithm getAlgorithm()
Gets the FailoverAlgorithm

Returns:
the failover algorithm

setAlgorithm

public void setAlgorithm(FailoverAlgorithm algorithm)
Sets the FailoverAlgorithm

Parameters:
algorithm - the failover algorithm to use

getInitialReconnectDelayMillis

public long getInitialReconnectDelayMillis()
Gets the initial time in milliseconds to wait before attempting reconnection

Returns:
the delay in milliseconds

setInitialReconnectDelayMillis

public void setInitialReconnectDelayMillis(long initialReconnectDelayMillis)
Sets the initial time in milliseconds to wait before attempting reconnection

Parameters:
initialReconnectDelayMillis - the delay in milliseconds

getMaxReconnectDelayMillis

public long getMaxReconnectDelayMillis()
Gets the maximum amount of time in milliseconds to wait between reconnection attempts. This value is only used when specifying exponential backoff, see setUseExponentialBackOff(boolean)

Returns:
the max delay in milliseconds

setMaxReconnectDelayMillis

public void setMaxReconnectDelayMillis(long maxReconnectDelayMillis)
Sets the maximum amount of time in milliseconds to wait between reconnection attempts. This value is only used when specifying exponential backoff, see setUseExponentialBackOff(boolean)

Parameters:
maxReconnectDelayMillis - the max delay in milliseconds

getMaxReconnectAttempts

public int getMaxReconnectAttempts()
Gets the maximum number of failed reconnection attempts before giving up. The default is to infinitely attempt to reconnect until the connection is re-established. This value is reset upon a successful reconnection.

Returns:
the maximum number of attempts

setMaxReconnectAttempts

public void setMaxReconnectAttempts(int maxReconnectAttempts)
Sets the maximum number of failed reconnection attempts before giving up. The default is to infinitely attempt to reconnect until the connection is re-established. This value is reset upon a successful reconnection.

Parameters:
maxReconnectAttempts - the maximum number of attempts

isUseExponentialBackOff

public boolean isUseExponentialBackOff()
Returns true if exponential backoff is enabled, false otherwise.

Returns:
true if exponential backoff is enabled, false otherwise

setUseExponentialBackOff

public void setUseExponentialBackOff(boolean useExponentialBackOff)
Enables or disables exponential backoff. This should be used in conjuction with setBackOffMultiplier(double)

Parameters:
useExponentialBackOff - true

getBackOffMultiplier

public double getBackOffMultiplier()
Gets the multiplier used when exponential backoff is enabled via setUseExponentialBackOff(boolean). The delay between each reconnect attempt will be multiplied by this number upon each failed reconnection attempt.

Returns:
the multiplier

setBackOffMultiplier

public void setBackOffMultiplier(double backOffMultiplier)
Sets the multiplier used when exponential backoff is enabled via setUseExponentialBackOff(boolean). The delay between each reconnect attempt will be multiplied by this number upon each failed reconnection attempt.


getServers

public List<String> getServers()
Gets the list of server URLs to connect to

Returns:
a list containing the server URLs


Copyright © 2009 StreamHub. Tutorials, news and guides can be found on the StreamHub Comet Blog.