setQuickReconnectInitialDelay method

dynamic setQuickReconnectInitialDelay(
  1. int seconds
)

\brief Define the number of seconds to wait before attempting to reconnect to the cluster after a connection failure is detected.

Reconnection Phases and Policies

When a connection failure is detected, the API will attempt to reconnect to the servers of the MigratoryData cluster as follows: First, it will attempt to reconnect up to a number of times as defined by \link MigratoryDataClient.setQuickReconnectMaxRetries() \endlink using small delays between retries ("Quick Reconnection Phase"). If the connection cannot be established after the Quick Reconnection Phase, then the API will attempt to reconnect less frequently according to the policy defined by \link MigratoryDataClient.setReconnectPolicy() \endlink.

The delays between retries are computed according to the following algorithm where the values of the variables involved are defined by the API methods having substantially the same names:

   Quick Reconnect Phase (retries <= quickReconnectMaxRetries)
   -----------------------------------------------------------

      (retries starts with 1 and increment by 1 at each quick reconnect)

      reconnectDelay = quickReconnectInitialDelay * retries - random(0, quickReconnectInitialDelay)

   After Quick Reconnect Phase (retries > quickReconnectMaxRetries)
   ----------------------------------------------------------------

      (reset retries to start with 1 and increment by 1 at each reconnect)

      If reconnectPolicy is CONSTANT_WINDOW_BACKOFF, then

         reconnectDelay = reconnectTimeInterval

      else if reconnectPolicy is TRUNCATED_EXPONENTIAL_BACKOFF, then

         reconnectDelay = min(reconnectTimeInterval * (2 ^ retries) - random(0, reconnectTimeInterval * retries), reconnectMaxDelay)

For a few users which are subject to temporary, atypical network conditions, if reconnectDelay computed with the algorithm above is less than 10 seconds, then it is rounded to 10 seconds.

\param seconds the number of seconds to wait before attempting to reconnect to the cluster; the default is \c 5

Implementation

setQuickReconnectInitialDelay(int seconds) {
  clientImpl.setQuickReconnectInitialDelay(seconds);
}