Interface RetryTimeout

  • All Superinterfaces:
    org.refcodes.mixin.Abortable, org.refcodes.mixin.Restartable, Retryable
    All Known Implementing Classes:
    RetryTimeoutImpl


    public interface RetryTimeout
    extends Retryable
    The RetryTimeout can be used in loops to test whether a timeout has been reached, if the timeout has not been reached, then a given period of time (delay) is waited. In case no more timeout is "left" the business logic may act accordingly such as throwing an exception.

    The actual timeout being waited is the effective time elapsed from the first call to Retryable.nextRetry() till the last call to Retryable.nextRetry(). Any delay inside the iteration loop is not added up to the delay.

    • Method Detail

      • nextRetry

        boolean nextRetry​(java.lang.Object aMonitor)
        Tests whether a next retry is possible. In case this is the case, then the thread is delayed by the configured (implementation specific) delay time or until the provided monitor is notified via Object.notify() or Object.notifyAll(). Similar to the Retryable.nextRetry() with the difference of accepting a dedicated monitor which is used for aborting the dellay.
        Parameters:
        aMonitor - the monitor
        Returns:
        True in case there is a next retry as of Retryable.hasNextRetry().
      • getRetryDelayInMs

        long getRetryDelayInMs​()
        Returns retry to wait in milliseconds upon calling Retryable.nextRetry()).
        Returns:
        The delay being set in milliseconds.