public class DefaultTimeoutModel extends Object implements ITimeoutModel
ITimeoutModel
. It uses a simple
model that starts (the first execution of the next()
) from the
initial value and double the value at each consecutive execution of the
next()
method. After reaching the max value the next()
method keeps returning the max value until the reset()
is called.Constructor and Description |
---|
DefaultTimeoutModel()
Constructs the model with default values: initial = 1000 and max = 60000
|
DefaultTimeoutModel(int initial,
long max)
Constructs the model with given initial value and max value.
|
Modifier and Type | Method and Description |
---|---|
long |
next()
Returns the next timeout value.
|
void |
reset()
Resets the model.
|
public DefaultTimeoutModel(int initial, long max)
initial
- the initial value in millisecondsmax
- the max value in millisecondspublic DefaultTimeoutModel()
public long next()
ITimeoutModel
next
in interface ITimeoutModel
public void reset()
ITimeoutModel
ITimeoutModel.next()
method
should return the initial value.reset
in interface ITimeoutModel
Copyright © 2017–2021 SNF4J.ORG. All rights reserved.