Class FixedRatePoller
- java.lang.Object
-
- com.cumulocity.sdk.client.polling.FixedRatePoller
-
- All Implemented Interfaces:
Poller
- Direct Known Subclasses:
OperationsByAgentAndStatusPollerImpl
public abstract class FixedRatePoller extends Object implements Poller
A poller that triggers tasks to execute at a fixed rate.
This class will trigger the defined pollingTask to run at the configured period.
-
-
Constructor Summary
Constructors Constructor Description FixedRatePoller(ScheduledThreadPoolExecutor pollingExecutor, long periodInterval)Create a fixed rate poller using the given thread pool and with the given fixed rate period.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longgetPeriod()protected RunnablegetPollingTask()protected voidsetPollingTask(Runnable pollingTask)booleanstart()Starts pollervoidstop()Stops poller after finishing all started jobs
-
-
-
Constructor Detail
-
FixedRatePoller
public FixedRatePoller(ScheduledThreadPoolExecutor pollingExecutor, long periodInterval)
Create a fixed rate poller using the given thread pool and with the given fixed rate period.- Parameters:
pollingExecutor- scheduled thread pool executorperiodInterval- polling interval in milliseconds
-
-
Method Detail
-
start
public boolean start()
Description copied from interface:PollerStarts poller
-
stop
public void stop()
Description copied from interface:PollerStops poller after finishing all started jobs
-
setPollingTask
protected void setPollingTask(Runnable pollingTask)
-
getPollingTask
protected Runnable getPollingTask()
-
getPeriod
protected long getPeriod()
- Returns:
- the fixed rate polling interval in milliseconds
-
-