org.apache.synapse.task
Class TaskScheduler

java.lang.Object
  extended by org.apache.synapse.task.TaskScheduler

public class TaskScheduler
extends Object

Abstraction for scheduling a Task


Field Summary
static String QUARTZ_CONF
          Property look up key for get a quartz configuration
 
Constructor Summary
TaskScheduler(String name)
           
 
Method Summary
 void deleteTask(String name, String group)
          Deletes a Task
 int getRunningTaskCount()
           
 void init(Properties properties)
          Initialize the scheduler based on provided properties Looking for 'quartz.conf' and if found , use it for initiating quartz scheduler
 boolean isInitialized()
           
 void pauseAll()
          Pauses all tasks.
 void resumeAll()
           
 void scheduleTask(TaskDescription taskDescription, Map<String,Object> resources, Class<? extends org.quartz.Job> jobClass)
          Schedule a Task
 void scheduleTask(TaskDescription taskDescription, Map<String,Object> resources, Class<? extends org.quartz.Job> jobClass, Task task)
          Schedule a Task
 void setJobDetailFactory(TaskJobDetailFactory jobDetailFactory)
          Sets a JobDetail Factory, if it needs to void using default factory
 void setTriggerFactory(TaskTriggerFactory triggerFactory)
          Sets a Trigger Factory , if it needs to void using default factory
 void shutDown()
          ShutDown the underlying quartz scheduler
 void start()
          Explicitly start up call for scheduler, return if already it has been started
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUARTZ_CONF

public static final String QUARTZ_CONF
Property look up key for get a quartz configuration

See Also:
Constant Field Values
Constructor Detail

TaskScheduler

public TaskScheduler(String name)
Method Detail

init

public void init(Properties properties)
Initialize the scheduler based on provided properties Looking for 'quartz.conf' and if found , use it for initiating quartz scheduler

Parameters:
properties - Properties

start

public void start()
Explicitly start up call for scheduler, return if already it has been started


pauseAll

public void pauseAll()
Pauses all tasks.

Throws:
SynapseTaskException - if an error occurs pausing all tasks.

resumeAll

public void resumeAll()

scheduleTask

public void scheduleTask(TaskDescription taskDescription,
                         Map<String,Object> resources,
                         Class<? extends org.quartz.Job> jobClass)
Schedule a Task

Parameters:
taskDescription - TaskDescription , an information about Task
resources - Any initial resources for task
jobClass - Quartz job class

scheduleTask

public void scheduleTask(TaskDescription taskDescription,
                         Map<String,Object> resources,
                         Class<? extends org.quartz.Job> jobClass,
                         Task task)
Schedule a Task

Parameters:
taskDescription - TaskDescription , an information about Task
resources - Any initial resources for task
jobClass - Quartz job class
task - The task to be executed

shutDown

public void shutDown()
ShutDown the underlying quartz scheduler


isInitialized

public boolean isInitialized()
Returns:
Returns true if the scheduler is ready for schedule a task

deleteTask

public void deleteTask(String name,
                       String group)
Deletes a Task

Parameters:
name - Name of the Task
group - Group name of the task Default value @see org.apache.synapse.util.task.TaskDescription.DEFAULT_GROUP

getRunningTaskCount

public int getRunningTaskCount()

setTriggerFactory

public void setTriggerFactory(TaskTriggerFactory triggerFactory)
Sets a Trigger Factory , if it needs to void using default factory

Parameters:
triggerFactory - TaskTriggerFactory instance

setJobDetailFactory

public void setJobDetailFactory(TaskJobDetailFactory jobDetailFactory)
Sets a JobDetail Factory, if it needs to void using default factory

Parameters:
jobDetailFactory - TaskJobDetailFactory instance

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.