Package org.tinyradius.client.retry
Class SimpleRetryStrategy
- java.lang.Object
-
- org.tinyradius.client.retry.SimpleRetryStrategy
-
- All Implemented Interfaces:
RetryStrategy
public class SimpleRetryStrategy extends java.lang.Object implements RetryStrategy
-
-
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.
-
-
-
Constructor Detail
-
SimpleRetryStrategy
public SimpleRetryStrategy(io.netty.util.Timer timer, int maxAttempts, int retryWait)
- Parameters:
timer
- netty timer for timing out requestsmaxAttempts
- max number of attempts to try before returning failureretryWait
- 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 interfaceRetryStrategy
- Parameters:
retry
- runnable to invoke to retrytotalAttempts
- current attempt countpromise
- request promise that resolves when a response is received
-
-