org.springframework.integration.quartz
Class QuartzScheduleServiceProvider

java.lang.Object
  extended by org.springframework.integration.quartz.QuartzScheduleServiceProvider
All Implemented Interfaces:
ScheduleServiceProvider

public class QuartzScheduleServiceProvider
extends java.lang.Object
implements ScheduleServiceProvider

A Quartz-based implementation of the ScheduleServiceProvider.

Author:
Marius Bogoevici

Nested Class Summary
 class QuartzScheduleServiceProvider.FixedDelayJobListener
          JobListener used for re-scheduling a fixed delay task, as Quartz does not support fixed delay tasks out of the box.
static class QuartzScheduleServiceProvider.InterruptableMethodInvokingJob
          Wrapper class allowing for Quartz jobs to be interrupted.
 class QuartzScheduleServiceProvider.ScheduledFutureJobWrapper
          Wrapper class for a Quartz Job, allowing running Quartz jobs top be manipulated via the ScheduledFuture interface.
 
Field Summary
private static java.lang.String FIXED_DELAY_PARAMETER
           
private  org.quartz.JobListener fixedDelayJobListener
           
private static java.lang.String RUN_METHOD_NAME
           
private static java.lang.String RUNNABLE_INSTANCE
           
private  org.quartz.Scheduler scheduler
           
private static java.util.concurrent.atomic.AtomicLong sequenceNumber
           
private static java.lang.String TIME_UNIT_PARAMETER
           
private static java.lang.String TRIGGER_NAME_PARAMETER
           
 
Constructor Summary
QuartzScheduleServiceProvider(org.quartz.Scheduler scheduler)
           
 
Method Summary
private static org.quartz.Trigger createFixedDelayTrigger(java.lang.Runnable runnable, long initialDelay, long taskDelay, java.util.concurrent.TimeUnit timeUnit)
           
 void execute(java.lang.Runnable runnable)
           
private static java.lang.String generateNameForInstance(java.lang.Object instance)
           
private static java.util.Date getFutureDate(long delay, java.util.concurrent.TimeUnit timeUnit)
           
 java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable runnable, long initialDelay, long period, java.util.concurrent.TimeUnit timeUnit)
           
 java.util.concurrent.ScheduledFuture<?> scheduleWithCronExpression(java.lang.Runnable runnable, java.lang.String cronExpression)
           
 java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable runnable, long initialDelay, long delay, java.util.concurrent.TimeUnit timeUnit)
           
 java.util.concurrent.ScheduledFuture<?> scheduleWithInitialDelay(java.lang.Runnable runnable, long initialDelay, java.util.concurrent.TimeUnit timeUnit)
           
private  java.util.concurrent.ScheduledFuture<?> scheduleWithTrigger(java.lang.Runnable runnable, org.quartz.Trigger fixedRateTrigger, java.lang.String[] jobListenerNames)
           
 void shutdown(boolean waitForTasksToCompleteOnShutdown)
           
private static org.quartz.JobDetail wrapAsJobDetail(java.lang.Runnable runnable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUN_METHOD_NAME

private static final java.lang.String RUN_METHOD_NAME
See Also:
Constant Field Values

RUNNABLE_INSTANCE

private static final java.lang.String RUNNABLE_INSTANCE
See Also:
Constant Field Values

FIXED_DELAY_PARAMETER

private static final java.lang.String FIXED_DELAY_PARAMETER
See Also:
Constant Field Values

TIME_UNIT_PARAMETER

private static final java.lang.String TIME_UNIT_PARAMETER
See Also:
Constant Field Values

TRIGGER_NAME_PARAMETER

private static final java.lang.String TRIGGER_NAME_PARAMETER
See Also:
Constant Field Values

sequenceNumber

private static final java.util.concurrent.atomic.AtomicLong sequenceNumber

scheduler

private final org.quartz.Scheduler scheduler

fixedDelayJobListener

private final org.quartz.JobListener fixedDelayJobListener
Constructor Detail

QuartzScheduleServiceProvider

public QuartzScheduleServiceProvider(org.quartz.Scheduler scheduler)
Method Detail

execute

public void execute(java.lang.Runnable runnable)
Specified by:
execute in interface ScheduleServiceProvider

shutdown

public void shutdown(boolean waitForTasksToCompleteOnShutdown)
Specified by:
shutdown in interface ScheduleServiceProvider

scheduleWithInitialDelay

public java.util.concurrent.ScheduledFuture<?> scheduleWithInitialDelay(java.lang.Runnable runnable,
                                                                        long initialDelay,
                                                                        java.util.concurrent.TimeUnit timeUnit)
                                                                 throws java.lang.Exception
Specified by:
scheduleWithInitialDelay in interface ScheduleServiceProvider
Throws:
java.lang.Exception

scheduleAtFixedRate

public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable runnable,
                                                                   long initialDelay,
                                                                   long period,
                                                                   java.util.concurrent.TimeUnit timeUnit)
                                                            throws java.lang.Exception
Specified by:
scheduleAtFixedRate in interface ScheduleServiceProvider
Throws:
java.lang.Exception

scheduleWithFixedDelay

public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable runnable,
                                                                      long initialDelay,
                                                                      long delay,
                                                                      java.util.concurrent.TimeUnit timeUnit)
                                                               throws java.lang.Exception
Specified by:
scheduleWithFixedDelay in interface ScheduleServiceProvider
Throws:
java.lang.Exception

scheduleWithCronExpression

public java.util.concurrent.ScheduledFuture<?> scheduleWithCronExpression(java.lang.Runnable runnable,
                                                                          java.lang.String cronExpression)
                                                                   throws java.lang.Exception
Specified by:
scheduleWithCronExpression in interface ScheduleServiceProvider
Throws:
java.lang.Exception

scheduleWithTrigger

private java.util.concurrent.ScheduledFuture<?> scheduleWithTrigger(java.lang.Runnable runnable,
                                                                    org.quartz.Trigger fixedRateTrigger,
                                                                    java.lang.String[] jobListenerNames)
                                                             throws java.lang.Exception
Throws:
java.lang.Exception

wrapAsJobDetail

private static org.quartz.JobDetail wrapAsJobDetail(java.lang.Runnable runnable)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

generateNameForInstance

private static java.lang.String generateNameForInstance(java.lang.Object instance)

getFutureDate

private static java.util.Date getFutureDate(long delay,
                                            java.util.concurrent.TimeUnit timeUnit)

createFixedDelayTrigger

private static org.quartz.Trigger createFixedDelayTrigger(java.lang.Runnable runnable,
                                                          long initialDelay,
                                                          long taskDelay,
                                                          java.util.concurrent.TimeUnit timeUnit)