com.alarmpoint.integrationagent.exceptions.retriable

## Class AbstractRetryPolicy

- java.lang.Object
- - com.alarmpoint.integrationagent.exceptions.retriable.AbstractRetryPolicy

- All Implemented Interfaces:
    DelayPolicy, RetryPolicy
  Direct Known Subclasses:
    MaxAttemptRetryPolicy, MaxTimeRetryPolicy

      public abstract class AbstractRetryPolicy
      extends java.lang.Object
      implements RetryPolicy

  A base class that provides pluggable delays so that subclasses need only implement `RetryPolicy.isRetriable(int, long)`.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractRetryPolicy(DelayPolicy delayPolicy)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getDelay(int numAttempts, long lastDelay)` Gets the minimum amount of time that must elapse before the next retry attempt.
    `java.lang.String` | `toString()` Returns a human-readable description of this policy.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.alarmpoint.integrationagent.exceptions.retriable.RetryPolicy

      `isRetriable`

- - ### Constructor Detail

    - #### AbstractRetryPolicy

          protected AbstractRetryPolicy(DelayPolicy delayPolicy)

      Default constructor.
      Parameters:
        `delayPolicy` - - the policy that computes delays between retry attempts; must be non-null

  - ### Method Detail

    - #### getDelay

          public long getDelay(int numAttempts,
                               long lastDelay)

      Gets the minimum amount of time that must elapse before the next retry attempt.
      Specified by:
        `getDelay` in interface `DelayPolicy`
      Parameters:
        `numAttempts` - - the number of previous attempts (including first attempt and retries); assumed to be >= 1
        `lastDelay` - - the delay (in milliseconds) returned by the previous call to this method (i.e., with `numAttempts-1`); -1 if not previously code (i.e., when `numAttempts==0`
      Returns:
        a non-negative integer indicating the delay in milliseconds

    - #### toString

          public java.lang.String toString()

      Description copied from interface: `DelayPolicy`
      Returns a human-readable description of this policy.
      Specified by:
        `toString` in interface `DelayPolicy`
      Overrides:
        `toString` in class `java.lang.Object`