public class GaussianIntervalPoller extends ScheduledTaskPoller
Implementation of Poller which polls at a random interval with a normal distribution.
Note: Logic is as follows:
Random.nextGaussian() * getMeanInterval() + getStandardDeviationInterval().
In the adapter configuration file this class is aliased as gaussian-interval-poller which is the preferred alternative to the fully qualified classname when building your configuration.
PollerImp.Callback
executor, pollerTask
Constructor and Description |
---|
GaussianIntervalPoller()
Creates a new instance.
|
GaussianIntervalPoller(TimeInterval meanInterval,
TimeInterval standardDeviationInterval) |
Modifier and Type | Method and Description |
---|---|
TimeInterval |
getMeanInterval() |
TimeInterval |
getStandardDeviationInterval() |
void |
init()
Initialises the component.
|
protected void |
scheduleTask() |
void |
setMeanInterval(TimeInterval meanInterval)
Set the mean to be used in poll interval calculation.
|
void |
setStandardDeviationInterval(TimeInterval standardDeviationInterval)
Set the standard deviation to be used in poll interval calculation.
|
close, getShutdownWaitTime, setShutdownWaitTime, start, stop
attemptLock, processMessages, registerConsumer, releaseLock, retrieveConsumer, withPollerCallback
public GaussianIntervalPoller()
Creates a new instance. Default mean is 0 seconds and standard deviation is 20 seconds.
public GaussianIntervalPoller(TimeInterval meanInterval, TimeInterval standardDeviationInterval)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
init
in class ScheduledTaskPoller
CoreException
- wrapping any underlying Exception
sprotected void scheduleTask()
scheduleTask
in class ScheduledTaskPoller
public TimeInterval getMeanInterval()
public void setMeanInterval(TimeInterval meanInterval)
meanInterval
- the mean interval (default 0 seconds)public TimeInterval getStandardDeviationInterval()
public void setStandardDeviationInterval(TimeInterval standardDeviationInterval)
standardDeviationInterval
- the standard deviation interval (default 20 seconds)