java.lang.Object
com.pushtechnology.diffusion.client.session.retry.RetryStrategy

public final class RetryStrategy extends Object
Defines a retry strategy.

A retry strategy will be applied when an initial to attempt to open a session fails with a SessionEstablishmentTransientException.

A retry strategy will be applied when recovering by a RecoverableUpdateStream following a recoverable exception.

The strategy is defined in terms of the number of milliseconds between retries and the maximum number of retries to attempt.

Since:
6.9
Author:
DiffusionData Limited
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final RetryStrategy
    The retry strategy that indicates that no retry is to be attempted.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RetryStrategy(long interval)
    Creates a new retry strategy that will retry indefinitely at the specified interval.
    RetryStrategy(long interval, int attempts)
    Creates a new retry strategy object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the number of retry attempts.
    long
    Returns the time interval between attempts.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NO_RETRY

      public static final RetryStrategy NO_RETRY
      The retry strategy that indicates that no retry is to be attempted.
  • Constructor Details

    • RetryStrategy

      public RetryStrategy(long interval, int attempts)
      Creates a new retry strategy object.
      Parameters:
      interval - the number of milliseconds before the first retry and between subsequent retries
      attempts - the number of retry attempts
    • RetryStrategy

      public RetryStrategy(long interval)
      Creates a new retry strategy that will retry indefinitely at the specified interval.
      Parameters:
      interval - the number of milliseconds before the first retry and between subsequent retries
  • Method Details

    • getInterval

      public long getInterval()
      Returns the time interval between attempts.
      Returns:
      the interval in ms.
    • getAttempts

      public int getAttempts()
      Returns the number of retry attempts.
      Returns:
      the number of retry attempts, where Integer.MAX_VALUE means infinite retries.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object