org.springframework.integration.scheduling.spi
Class ProviderTaskScheduler

java.lang.Object
  extended by org.springframework.integration.scheduling.spi.ProviderTaskScheduler
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle, org.springframework.core.task.TaskExecutor, TaskScheduler, org.springframework.scheduling.SchedulingTaskExecutor

public class ProviderTaskScheduler
extends java.lang.Object
implements TaskScheduler, org.springframework.beans.factory.DisposableBean

An implementation of TaskScheduler that understands PollingSchedules and delegates to a ScheduleServiceProvider instance.

Author:
Mark Fisher, Marius Bogoevici

Nested Class Summary
private  class ProviderTaskScheduler.TaskRunner
           
 
Field Summary
private  ErrorHandler errorHandler
           
private  java.lang.Object lifecycleMonitor
           
private  org.apache.commons.logging.Log logger
           
private  java.util.Set<java.lang.Runnable> pendingTasks
           
private  boolean running
           
private  java.util.Map<java.lang.Runnable,java.util.concurrent.ScheduledFuture<?>> scheduledTasks
           
private  ScheduleServiceProvider scheduleServiceProvider
           
private  boolean waitForTasksToCompleteOnShutdown
           
 
Constructor Summary
ProviderTaskScheduler(ScheduleServiceProvider scheduleServiceProvider)
           
 
Method Summary
 boolean cancel(java.lang.Runnable task, boolean mayInterruptIfRunning)
           
 void destroy()
           
 void execute(java.lang.Runnable task)
           
 boolean isRunning()
           
 boolean prefersShortLivedTasks()
           
 java.util.concurrent.ScheduledFuture<?> schedule(SchedulableTask task)
           
 void setErrorHandler(ErrorHandler errorHandler)
           
 void setWaitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private final org.apache.commons.logging.Log logger

scheduleServiceProvider

private ScheduleServiceProvider scheduleServiceProvider

waitForTasksToCompleteOnShutdown

private volatile boolean waitForTasksToCompleteOnShutdown

errorHandler

private volatile ErrorHandler errorHandler

pendingTasks

private final java.util.Set<java.lang.Runnable> pendingTasks

scheduledTasks

private final java.util.Map<java.lang.Runnable,java.util.concurrent.ScheduledFuture<?>> scheduledTasks

running

private volatile boolean running

lifecycleMonitor

private final java.lang.Object lifecycleMonitor
Constructor Detail

ProviderTaskScheduler

public ProviderTaskScheduler(ScheduleServiceProvider scheduleServiceProvider)
Method Detail

setWaitForTasksToCompleteOnShutdown

public void setWaitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown)

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Specified by:
setErrorHandler in interface TaskScheduler

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle

start

public void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean

prefersShortLivedTasks

public boolean prefersShortLivedTasks()
Specified by:
prefersShortLivedTasks in interface org.springframework.scheduling.SchedulingTaskExecutor

execute

public void execute(java.lang.Runnable task)
Specified by:
execute in interface org.springframework.core.task.TaskExecutor

schedule

public java.util.concurrent.ScheduledFuture<?> schedule(SchedulableTask task)
Specified by:
schedule in interface TaskScheduler

cancel

public boolean cancel(java.lang.Runnable task,
                      boolean mayInterruptIfRunning)
Specified by:
cancel in interface TaskScheduler