org.mule.api.schedule
Interface Scheduler
- All Superinterfaces:
- Disposable, Initialisable, Lifecycle, NameableObject, NamedObject, Startable, Stoppable
- All Known Implementing Classes:
- CronScheduler, FixedFrequencyScheduler, PollScheduler
public interface Scheduler
- extends Lifecycle, NameableObject
An scheduler is a class that arrange jobs in a define schedule. Once the Scheduler starts it launch a thread that
triggers an action, when stopped, that action is not executed anymore, unless it is scheduled on demand by
the method schedule()
The initialization of a Scheduler is thought to be the stage where it reserves resources to schedule. While the
dispose phase is thought to be the stage where those resources are released.
This interface implements NameableObject
the name of the Scheduler is used as its identifier in the
MuleRegistry
The recommended way to create a Scheduler is by a SchedulerFactory
, this will allow other users to hook the
Scheduler creation. This can me omitted if this is not desired.
Each scheduler is thought to schedule a single job. Check the SchedulerFactory#create(String, Object)
to see the
creation of the scheduler for more details.
- Since:
- 3.5.0
Method Summary |
void |
schedule()
Launches the action asynchronously. |
Methods inherited from interface org.mule.api.lifecycle.Startable |
start |
Methods inherited from interface org.mule.api.lifecycle.Stoppable |
stop |
schedule
void schedule()
throws Exception
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.
- Throws:
Exception
- If the job could not be scheduled.
Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.