org.mule.api.schedule
Class SchedulerFactory<T extends Runnable>

java.lang.Object
  extended by org.mule.api.schedule.SchedulerFactory<T>
Type Parameters:
T - is the type of the scheduler job (what is the scheduler going to execute)
All Implemented Interfaces:
MuleContextAware
Direct Known Subclasses:
CronSchedulerFactory, FixedFrequencySchedulerFactory

public abstract class SchedulerFactory<T extends Runnable>
extends Object
implements MuleContextAware

Factory of schedulers. Every Scheduler should be created by a SchedulerFactory if the creation process allows post creation hooking.

Once the Factory creates a scheduler it calls a set of SchedulerFactoryPostProcessor that might affect the instance of the scheduler.

The SchedulerFactory also registers the Scheduler into the mule registry.

Since:
3.5.0

Field Summary
protected  MuleContext context
           Mule context.
protected  Log logger
           
 
Constructor Summary
SchedulerFactory()
           
 
Method Summary
 Scheduler create(String name, T job)
           Creates a scheduler for a job and runs all the registered post processors.
protected abstract  Scheduler doCreate(String name, T job)
           Template method to delegate the creation of the Scheduler.
 void setMuleContext(MuleContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected transient Log logger

context

protected MuleContext context

Mule context. Should never be null. In case of being null then the post processing is discarded

Constructor Detail

SchedulerFactory

public SchedulerFactory()
Method Detail

create

public final Scheduler create(String name,
                              T job)
                       throws SchedulerCreationException

Creates a scheduler for a job and runs all the registered post processors.

Parameters:
job - The Scheduler job that has to be executed.
name - The Scheduler name. This name is the one that is going to be use to register the Scheduler in the MuleRegistry
Returns:
A new instance of a Scheduler. It must never be null.
Throws:
SchedulerCreationException - In case after creating and post processing the Scheduler it is null or in case a SchedulerFactoryPostProcessor fails.

doCreate

protected abstract Scheduler doCreate(String name,
                                      T job)

Template method to delegate the creation of the Scheduler. This method is thought to create an instance of a Scheduler. It should not Start/Stop it.

Parameters:
name -
job - The Job the Scheduler is going to execute
Returns:
The Scheduler instance

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.