Class FixedRatePoller
java.lang.Object
com.cumulocity.sdk.client.polling.FixedRatePoller
- All Implemented Interfaces:
Poller
- Direct Known Subclasses:
OperationsByAgentAndStatusPollerImpl
A poller that triggers tasks to execute at a fixed rate.
This class will trigger the defined pollingTask to run at the configured period.
This class will trigger the defined pollingTask to run at the configured period.
-
Constructor Summary
ConstructorDescriptionFixedRatePoller
(ScheduledThreadPoolExecutor pollingExecutor, long periodInterval) Create a fixed rate poller using the given thread pool and with the given fixed rate period. -
Method Summary
Modifier and TypeMethodDescriptionprotected long
protected Runnable
protected void
setPollingTask
(Runnable pollingTask) boolean
start()
Starts pollervoid
stop()
Stops poller after finishing all started jobs
-
Constructor Details
-
FixedRatePoller
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 Details
-
start
public boolean start()Description copied from interface:Poller
Starts poller -
stop
public void stop()Description copied from interface:Poller
Stops poller after finishing all started jobs -
setPollingTask
-
getPollingTask
-
getPeriod
protected long getPeriod()- Returns:
- the fixed rate polling interval in milliseconds
-