com.cumulocity.sdk.client
Class FixedRatePoller

java.lang.Object
  extended by com.cumulocity.sdk.client.FixedRatePoller
All Implemented Interfaces:
Poller
Direct Known Subclasses:
MeasurementFixedRatePoller, 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
FixedRatePoller(ScheduledThreadPoolExecutor pollingExecutor, long periodInterval)
          Create a fixed rate poller using the given thread pool and with the given fixed rate period.
 
Method Summary
protected  long getPeriod()
           
protected  Runnable getPollingTask()
           
protected  void setPollingTask(Runnable pollingTask)
           
 boolean start()
          Starts poller
 void stop()
          Stops poller after finishing all started jobs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
periodInterval - polling interval in milliseconds
Method Detail

start

public boolean start()
Description copied from interface: Poller
Starts poller

Specified by:
start in interface Poller
Returns:
true if the poller was successfully started

stop

public void stop()
Description copied from interface: Poller
Stops poller after finishing all started jobs

Specified by:
stop in interface Poller

setPollingTask

protected void setPollingTask(Runnable pollingTask)

getPollingTask

protected Runnable getPollingTask()

getPeriod

protected long getPeriod()
Returns:
the fixed rate polling interval in milliseconds


Copyright © 2013 (C) Cumulocity GmbH. All Rights Reserved.