com.kuka.comm
Class ReconnectStrategies

java.lang.Object
  extended by com.kuka.comm.ReconnectStrategies

public final class ReconnectStrategies
extends Object

This class provides some static factory methods for creating different reconnect strategies.


Method Summary
static ReconnectStrategy alwaysReconnect()
          Creates a ReconnectStrategy that will allow infinite reconnection attempts.
static ReconnectStrategy maxReconnectFailures(int maxTotalFailures)
          Creates a ReconnectStrategy that will only allow a certain total number of reconnection attempts per connection.
static ReconnectStrategy maxReconnectFailuresWithReset(int maxFailuresInARow)
          This class implements an ReconnectStrategy that will restrict the number of failed reconnection attempts in a row by a given value (per connection).
static ReconnectStrategy neverReconnect()
          Creates a ReconnectStrategy that will reject any reconnection attempts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

neverReconnect

public static ReconnectStrategy neverReconnect()
Creates a ReconnectStrategy that will reject any reconnection attempts. A connection using this strategy will never try to reconnect automatically.

Returns:
the reconnect strategy

alwaysReconnect

public static ReconnectStrategy alwaysReconnect()
Creates a ReconnectStrategy that will allow infinite reconnection attempts. A connection using this strategy will always try to reconnect when the connection breaks down.

Returns:
the reconnect strategy

maxReconnectFailures

public static ReconnectStrategy maxReconnectFailures(int maxTotalFailures)
Creates a ReconnectStrategy that will only allow a certain total number of reconnection attempts per connection. A successful reconnection attempt does not reset the number of failures. The failed attempts are thus counted over the entire lifetime of the connection, no matter if there have been any successful reconnection attempts in the meantime.

Parameters:
maxTotalFailures - the maximum allowed total reconnection failures
Returns:
the reconnect strategy

maxReconnectFailuresWithReset

public static ReconnectStrategy maxReconnectFailuresWithReset(int maxFailuresInARow)
This class implements an ReconnectStrategy that will restrict the number of failed reconnection attempts in a row by a given value (per connection). A successful reconnection attempt will reset the number of failures. Thus, the total number of failed attempts throughout the entire lifetime of a connection might be unlimited, but the connection will stop to reconnect after the given number of failed attempts in a row has been reached.

Parameters:
maxFailuresInARow - the maximum allowed reconnection failures in a row
Returns:
the reconnect strategy


Copyright © 2019. All rights reserved.