public class BasicTimeoutHandler extends java.lang.Object implements TimeoutHandler
Constructor and Description |
---|
BasicTimeoutHandler(io.netty.util.Timer timer) |
BasicTimeoutHandler(io.netty.util.Timer timer,
int maxAttempts,
int timeoutMs) |
Modifier and Type | Method and Description |
---|---|
void |
onTimeout(java.lang.Runnable callback,
int totalAttempts,
io.netty.util.concurrent.Promise<RadiusResponse> promise)
Schedule a retry in the future.
|
public BasicTimeoutHandler(io.netty.util.Timer timer)
public BasicTimeoutHandler(io.netty.util.Timer timer, int maxAttempts, int timeoutMs)
timer
- netty timer for timing out requestsmaxAttempts
- max number of attempts to try before returning failuretimeoutMs
- time to wait before timeout or next retry, in millisecondspublic void onTimeout(java.lang.Runnable callback, int totalAttempts, io.netty.util.concurrent.Promise<RadiusResponse> promise)
TimeoutHandler
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.
onTimeout
in interface TimeoutHandler
callback
- runnable to invoke to retrytotalAttempts
- current attempt countpromise
- request promise that resolves when a response is received