org.mule.modules.schedulers.cron
Class CronScheduler

java.lang.Object
  extended by org.mule.transport.polling.schedule.PollScheduler<PollingReceiverWorker>
      extended by org.mule.modules.schedulers.cron.CronScheduler
All Implemented Interfaces:
MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, NameableObject, NamedObject, Scheduler

public class CronScheduler
extends PollScheduler<PollingReceiverWorker>
implements MuleContextAware

Cron Scheduler implemented with Quartz.

Since:
3.5.0

Field Summary
protected  Log logger
           
static String POLL_CRON_SCHEDULER_JOB
           
static String THREAD_POLL_CLASS
           
static String THREAD_POLL_CLASS_PROPERTY
           
static String THREAD_POOL_COUNT_PROPERTY
           
 
Fields inherited from class org.mule.transport.polling.schedule.PollScheduler
job, name
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
CronScheduler(String name, PollingReceiverWorker job, String cronExpression)
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 String getCronExpression()
           
 void initialise()
          Method used to perform any initialisation work.
 void schedule()
           Launches the action asynchronously.
 void setMuleContext(MuleContext context)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.mule.transport.polling.schedule.PollScheduler
getName, setName
 
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

THREAD_POLL_CLASS_PROPERTY

public static final String THREAD_POLL_CLASS_PROPERTY
See Also:
Constant Field Values

THREAD_POLL_CLASS

public static final String THREAD_POLL_CLASS
See Also:
Constant Field Values

THREAD_POOL_COUNT_PROPERTY

public static final String THREAD_POOL_COUNT_PROPERTY
See Also:
Constant Field Values

POLL_CRON_SCHEDULER_JOB

public static final String POLL_CRON_SCHEDULER_JOB
See Also:
Constant Field Values
Constructor Detail

CronScheduler

public CronScheduler(String name,
                     PollingReceiverWorker job,
                     String cronExpression)
Method Detail

schedule

public void schedule()
              throws Exception
Description copied from interface: Scheduler

Launches the action asynchronously. The time can or can't be immediate depending on the Scheduler implementation.

By default, schedulers users can use a scheduler not matter if it is started or stopped. By default the Scheduler implementation should schedule a job regardless of it lifecycle state. If this is not accepted then check Scheduler state and throw exception.

Specified by:
schedule in interface Scheduler
Throws:
Exception - If the job could not be scheduled.

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

start

public void start()
           throws MuleException
Specified by:
start in interface Startable
Throws:
MuleException

stop

public void stop()
          throws MuleException
Specified by:
stop in interface Stoppable
Throws:
MuleException

getCronExpression

public String getCronExpression()

setMuleContext

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


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