Class SimpleRetryStrategy

    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleRetryStrategy​(io.netty.util.Timer timer, int maxAttempts, int retryWait)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void scheduleRetry​(java.lang.Runnable retry, int totalAttempts, io.netty.util.concurrent.Promise<RadiusPacket> promise)
      Schedule a retry in the future.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleRetryStrategy

        public SimpleRetryStrategy​(io.netty.util.Timer timer,
                                   int maxAttempts,
                                   int retryWait)
        Parameters:
        timer - netty timer for timing out requests
        maxAttempts - max number of attempts to try before returning failure
        retryWait - time to wait before next retry, in milliseconds
    • Method Detail

      • scheduleRetry

        public void scheduleRetry​(java.lang.Runnable retry,
                                  int totalAttempts,
                                  io.netty.util.concurrent.Promise<RadiusPacket> promise)
        Description copied from interface: RetryStrategy
        Schedule a retry in the future. Invoked immediately after a request is sent to schedule next retry.

        When retry is due to run, should also check if promise isDone() before running.

        Implemented here instead of RadiusClient so custom scheduling / retry backoff can be used depending on implementation, and actual retry can be deferred. Scheduling and logic should be implemented here, while RadiusClient only deals with IO.

        Specified by:
        scheduleRetry in interface RetryStrategy
        Parameters:
        retry - runnable to invoke to retry
        totalAttempts - current attempt count
        promise - request promise that resolves when a response is received