Class Overview
Default retry policy for queries.
The default retry policy has three characteristics:
- Initial timeout: the time after which the request is stopped when no
answer is received
- Maximal number of retry: The maximal number of times we relaunch the
request after it was stopped because of timeout
- Backoff multiplier: the value by which to multiply the timeout before
each retry. The formula applied before each retry is the following:
currentTimeout += (currentTimeout * backoffMultiplier);
Summary
Public Constructors |
|
DefaultRetryPolicy()
Constructs a new retry policy using the default values.
|
|
DefaultRetryPolicy(int initialTimeoutMs, int maxNumRetries, float backoffMultiplier)
Constructs a new retry policy.
|
Public Methods |
int
|
getCurrentRetryCount()
Returns the current retry count (this getter is used for logging).
|
int
|
getCurrentTimeout()
Returns the current timeout (this getter is used for logging).
|
void
|
retry(ContentError error)
Prepares for the next retry by applying a backoff to the timeout.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
final
Class<?>
|
getClass()
Returns the runtime class of an object.
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeout, int nanos)
Causes current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or some other
thread interrupts the current thread, or a certain amount of real time has
elapsed.
|
final
void
|
wait(long timeout)
Causes current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a specified
amount of time has elapsed.
|
final
void
|
wait()
Causes current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
From interface
com.neomades.content.retry.RetryPolicy
abstract
int
|
getCurrentRetryCount()
Returns the current retry count (this getter is used for logging).
|
abstract
int
|
getCurrentTimeout()
Returns the current timeout (this getter is used for logging).
|
abstract
void
|
retry(ContentError error)
Prepares for the next retry by applying a backoff to the timeout.
|
|
Public Constructors
public
DefaultRetryPolicy
()
Constructs a new retry policy using the default values.
- default timeout: 2,5 seconds
- maxNumRetries: 1 time
- Backoff multiplier: 1
public
DefaultRetryPolicy
(int initialTimeoutMs, int maxNumRetries, float backoffMultiplier)
Constructs a new retry policy.
Parameters
initialTimeoutMs |
The initial timeout for the policy. |
maxNumRetries |
The maximum number of retries. |
backoffMultiplier |
Backoff multiplier for the policy.
|
Public Methods
public
int
getCurrentRetryCount
()
Returns the current retry count (this getter is used for logging).
This getter is used by ContentManager
to print out to the console
(for logging), after how many retry count the query is retrying.
This value should be used and updated by RetryPolicy
implementation.
Returns
- the current retry count (used for logging).
public
int
getCurrentTimeout
()
Returns the current timeout (this getter is used for logging).
This getter is used by ContentManager
to print out to the console
(for logging), after which timeout the query is retrying.
This value should be used and updated by RetryPolicy
implementation.
Returns
- the current timeout (used for logging).
public
void
retry
(ContentError error)
Prepares for the next retry by applying a backoff to the timeout.
Current timeout will increase each time this method will be called. If the
max number of retries has been reached this method will throw an exception to
stop retrying.
Parameters
error |
The error of the last attempt.
|