|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.multiverse.api.backoff.ExponentialBackoffPolicy
public final class ExponentialBackoffPolicy
A BackoffPolicy that does an exponential backoff. So each next attempt, the delay is doubled until a
configurable maximum delay has been reached.
| Field Summary | |
|---|---|
static ExponentialBackoffPolicy |
INSTANCE_100_MS_MAX
|
| Constructor Summary | |
|---|---|
ExponentialBackoffPolicy()
Creates an ExponentialBackoffPolicy with 100 nanoseconds as minimal delay and 100 milliseconds as maximum delay. |
|
ExponentialBackoffPolicy(long minDelayNs,
long maxDelay,
TimeUnit unit)
Creates an ExponentialBackoffPolicy with given maximum delay. |
|
| Method Summary | |
|---|---|
protected long |
calcDelayNs(Transaction tx)
|
void |
delay(Transaction t)
Executes the delay. |
void |
delayedUninterruptible(Transaction t)
Executes the delay without the possibility of being interrupted. |
long |
getMaxDelayNs()
Returns the maximum delay in nanoseconds. |
long |
getMinDelayNs()
Returns the minimum delay in nanoseconds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ExponentialBackoffPolicy INSTANCE_100_MS_MAX
| Constructor Detail |
|---|
public ExponentialBackoffPolicy()
public ExponentialBackoffPolicy(long minDelayNs,
long maxDelay,
TimeUnit unit)
minDelayNs - the minimum delay in nanoseconds to wait. If a negative or zero value provided, it will be
interpreted that no external minimal value is needed.maxDelay - the maximum delay.unit - the unit of maxDelay.
NullPointerException - if unit is null.| Method Detail |
|---|
public long getMaxDelayNs()
public long getMinDelayNs()
public void delay(Transaction t)
throws InterruptedException
BackoffPolicy
delay in interface BackoffPolicyt - the transaction that is going to be restarted. The transaction should never be null, but it
depends on the implementation if this is checked.
InterruptedException - if the delay is interrupted.public void delayedUninterruptible(Transaction t)
BackoffPolicy
delayedUninterruptible in interface BackoffPolicyt - the transaction that is going to be restarted. The transaction should never be null, but it
depends on the implementation if this is checked.protected long calcDelayNs(Transaction tx)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||