T
- the return type of poll taskpublic abstract class PollingTaskSupport<T>
extends java.lang.Object
TaskScheduler
and TaskExecutor
.Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor)
PeriodicTrigger
is used.taskScheduler
- the task schedulertaskExecutor
- the task executorpublic PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor, java.util.concurrent.TimeUnit unit, long duration)
PeriodicTrigger
is used.taskScheduler
- the task schedulertaskExecutor
- the task executorunit
- the unitduration
- the durationpublic PollingTaskSupport(org.springframework.scheduling.TaskScheduler taskScheduler, org.springframework.core.task.TaskExecutor taskExecutor, org.springframework.scheduling.Trigger trigger)
taskScheduler
- the task schedulertaskExecutor
- the task executortrigger
- the triggerpublic void init()
public void start()
public void stop()
public void setTrigger(org.springframework.scheduling.Trigger trigger)
trigger
- the new triggerprotected abstract T doPoll()
protected void onPollResult(T result)
result
- the result