com.atlassian.sal.core.scheduling
Class TimerPluginScheduler

java.lang.Object
  extended by com.atlassian.sal.core.scheduling.TimerPluginScheduler
All Implemented Interfaces:
PluginScheduler, org.springframework.beans.factory.DisposableBean

public class TimerPluginScheduler
extends Object
implements PluginScheduler, org.springframework.beans.factory.DisposableBean

Plugin scheduler that uses java.util.Timer


Constructor Summary
  TimerPluginScheduler()
           
protected TimerPluginScheduler(Map<String,Timer> tasks, boolean useDaemons)
           
 
Method Summary
 void destroy()
           
 void scheduleJob(String name, Class<? extends PluginJob> job, Map<String,Object> jobDataMap, Date startTime, long repeatInterval)
          Schedule the given job.
 void unscheduleJob(String name)
          Unschedule the given job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerPluginScheduler

public TimerPluginScheduler()

TimerPluginScheduler

protected TimerPluginScheduler(Map<String,Timer> tasks,
                               boolean useDaemons)
Method Detail

scheduleJob

public void scheduleJob(String name,
                        Class<? extends PluginJob> job,
                        Map<String,Object> jobDataMap,
                        Date startTime,
                        long repeatInterval)
Description copied from interface: PluginScheduler
Schedule the given job.

WARNING: it is very important not to try to call this method until the underlying application is fully started. You should implement LifecycleAware and call scheduleJob() only on LifecycleAware.onStart()

Specified by:
scheduleJob in interface PluginScheduler
Parameters:
name - A unique key of the job
job - The class for the job
jobDataMap - Any data that needs to be passed to the job. This map instance will always be the same instance that is given to the job when it executes.
startTime - The time the job is to start.
repeatInterval - How long the interval between repeats, in milliseconds. Note, some implementations

destroy

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

unscheduleJob

public void unscheduleJob(String name)
Description copied from interface: PluginScheduler
Unschedule the given job. If the job doesn't exist then IllegalArgumentException will be thrown.

Specified by:
unscheduleJob in interface PluginScheduler
Parameters:
name - The job key to unschedule


Copyright © 2015 Atlassian. All rights reserved.