Spring for Apache Hadoop

org.springframework.data.hadoop.store.support
Class PollingTaskSupport<T>

java.lang.Object
  extended by org.springframework.data.hadoop.store.support.PollingTaskSupport<T>
Type Parameters:
T - the return type of poll task

public abstract class PollingTaskSupport<T>
extends java.lang.Object

Helper class to ease working with polling tasks executed using Spring TaskScheduler and TaskExecutor.

Author:
Janne Valkealahti

Constructor Summary
PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor)
          Instantiates a new polling task support.
PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor, java.util.concurrent.TimeUnit unit, long duration)
          Instantiates a new polling task support.
PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor, org.springframework.scheduling.Trigger trigger)
          Instantiates a new polling task support.
 
Method Summary
protected abstract  T doPoll()
          Do poll.
 void init()
          Inits the poller.
protected  void onPollResult(T result)
          Callback on poll result.
 void setTrigger(org.springframework.scheduling.Trigger trigger)
          Sets the trigger.
 void start()
          Starts the poller.
 void stop()
          Stops the poller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollingTaskSupport

public PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler,
                          org.springframework.core.task.TaskExecutor taskExecutor)
Instantiates a new polling task support. On default a simple PeriodicTrigger is used.

Parameters:
taskScheduler - the task scheduler
taskExecutor - the task executor

PollingTaskSupport

public PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler,
                          org.springframework.core.task.TaskExecutor taskExecutor,
                          java.util.concurrent.TimeUnit unit,
                          long duration)
Instantiates a new polling task support. On default a simple PeriodicTrigger is used.

Parameters:
taskScheduler - the task scheduler
taskExecutor - the task executor
unit - the unit
duration - the duration

PollingTaskSupport

public PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler,
                          org.springframework.core.task.TaskExecutor taskExecutor,
                          org.springframework.scheduling.Trigger trigger)
Instantiates a new polling task support.

Parameters:
taskScheduler - the task scheduler
taskExecutor - the task executor
trigger - the trigger
Method Detail

init

public void init()
Inits the poller.


start

public void start()
Starts the poller.


stop

public void stop()
Stops the poller.


setTrigger

public void setTrigger(org.springframework.scheduling.Trigger trigger)
Sets the trigger.

Parameters:
trigger - the new trigger

doPoll

protected abstract T doPoll()
Do poll.

Returns:
the poll result

onPollResult

protected void onPollResult(T result)
Callback on poll result. Default implementation doesn't do nothing.

Parameters:
result - the result

Spring for Apache Hadoop