Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.spi
Interface JobStore

All Known Implementing Classes:
  JobStoreCMT, JobStoreSupport, JobStoreTX, RAMJobStore

    public interface JobStore

The interface to be implemented by classes that want to provide a ``Job`` and ``Trigger`` storage mechanism for the ``QuartzScheduler``'s use.

Storage of `Job` s and `Trigger` s should be keyed on the combination of their name and group for uniqueness.

Author:
  James House, Eric Mueller
See Also:
  `QuartzScheduler`, `Trigger`, `Job`, `JobDetail`, `JobDataMap`, `Calendar`

Method Summary
`Trigger` | `acquireNextTrigger(SchedulingContext ctxt, long noLaterThan)` Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.
`String[]` | `getCalendarNames(SchedulingContext ctxt)` Get the names of all of the ``Calendar`` s in the `JobStore`.
`long` | `getEstimatedTimeToReleaseAndAcquireTrigger()` How long (in milliseconds) the `JobStore` implementation estimates that it will take to release a trigger and acquire a new one.
`String[]` | `getJobGroupNames(SchedulingContext ctxt)` Get the names of all of the ``Job`` groups.
`String[]` | `getJobNames(SchedulingContext ctxt, String groupName)` Get the names of all of the ``Job`` s that have the given group name.
`int` | `getNumberOfCalendars(SchedulingContext ctxt)` Get the number of ``Calendar`` s that are stored in the `JobsStore`.
`int` | `getNumberOfJobs(SchedulingContext ctxt)` Get the number of ``Job`` s that are stored in the `JobsStore`.
`int` | `getNumberOfTriggers(SchedulingContext ctxt)` Get the number of ``Trigger`` s that are stored in the `JobsStore`.
`Set` | `getPausedTriggerGroups(SchedulingContext ctxt)`
`String[]` | `getTriggerGroupNames(SchedulingContext ctxt)` Get the names of all of the ``Trigger`` groups.
`String[]` | `getTriggerNames(SchedulingContext ctxt, String groupName)` Get the names of all of the ``Trigger`` s that have the given group name.
`Trigger[]` | `getTriggersForJob(SchedulingContext ctxt, String jobName, String groupName)` Get all of the Triggers that are associated to the given Job.
`int` | `getTriggerState(SchedulingContext ctxt, String triggerName, String triggerGroup)` Get the current state of the identified ``Trigger``.
`void` | `initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)` Called by the QuartzScheduler before the `JobStore` is used, in order to give the it a chance to initialize.
`boolean` | `isClustered()` Whether or not the `JobStore` implementation is clustered.
`void` | `pauseAll(SchedulingContext ctxt)` Pause all triggers - equivalent of calling `pauseTriggerGroup(group)` on every group.
`void` | `pauseJob(SchedulingContext ctxt, String jobName, String groupName)` Pause the ``Job`` with the given name - by pausing all of its current `Trigger`s.
`void` | `pauseJobGroup(SchedulingContext ctxt, String groupName)` Pause all of the ``Job`s` in the given group - by pausing all of their `Trigger`s.
`void` | `pauseTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Pause the ``Trigger`` with the given name.
`void` | `pauseTriggerGroup(SchedulingContext ctxt, String groupName)` Pause all of the ``Trigger`s` in the given group.
`void` | `releaseAcquiredTrigger(SchedulingContext ctxt, Trigger trigger)` Inform the `JobStore` that the scheduler no longer plans to fire the given `Trigger`, that it had previously acquired (reserved).
`boolean` | `removeCalendar(SchedulingContext ctxt, String calName)` Remove (delete) the ``Calendar`` with the given name.
`boolean` | `removeJob(SchedulingContext ctxt, String jobName, String groupName)` Remove (delete) the ``Job`` with the given name, and any ``Trigger`` s that reference it.
`boolean` | `removeTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Remove (delete) the ``Trigger`` with the given name.
`boolean` | `replaceTrigger(SchedulingContext ctxt, String triggerName, String groupName, Trigger newTrigger)` Remove (delete) the ``Trigger`` with the given name, and store the new given one - which must be associated with the same job.
`void` | `resumeAll(SchedulingContext ctxt)` Resume (un-pause) all triggers - equivalent of calling `resumeTriggerGroup(group)` on every group.
`void` | `resumeJob(SchedulingContext ctxt, String jobName, String groupName)` Resume (un-pause) the ``Job`` with the given name.
`void` | `resumeJobGroup(SchedulingContext ctxt, String groupName)` Resume (un-pause) all of the ``Job`s` in the given group.
`void` | `resumeTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Resume (un-pause) the ``Trigger`` with the given name.
`void` | `resumeTriggerGroup(SchedulingContext ctxt, String groupName)` Resume (un-pause) all of the ``Trigger`s` in the given group.
`Calendar` | `retrieveCalendar(SchedulingContext ctxt, String calName)` Retrieve the given ``Trigger``.
`JobDetail` | `retrieveJob(SchedulingContext ctxt, String jobName, String groupName)` Retrieve the ``JobDetail`` for the given ``Job``.
`Trigger` | `retrieveTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Retrieve the given ``Trigger``.
`void` | `schedulerStarted()` Called by the QuartzScheduler to inform the `JobStore` that the scheduler has started.
`void` | `setInstanceId(String schedInstId)` Inform the `JobStore` of the Scheduler instance's Id, prior to initialize being invoked.
`void` | `setInstanceName(String schedName)` Inform the `JobStore` of the Scheduler instance's name, prior to initialize being invoked.
`void` | `shutdown()` Called by the QuartzScheduler to inform the `JobStore` that it should free up all of it's resources because the scheduler is shutting down.
`void` | `storeCalendar(SchedulingContext ctxt, String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers)` Store the given ``Calendar``.
`void` | `storeJob(SchedulingContext ctxt, JobDetail newJob, boolean replaceExisting)` Store the given ``JobDetail``.
`void` | `storeJobAndTrigger(SchedulingContext ctxt, JobDetail newJob, Trigger newTrigger)` Store the given ``JobDetail`` and ``Trigger``.
`void` | `storeTrigger(SchedulingContext ctxt, Trigger newTrigger, boolean replaceExisting)` Store the given ``Trigger``.
`boolean` | `supportsPersistence()`
`void` | `triggeredJobComplete(SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail, int triggerInstCode)` Inform the `JobStore` that the scheduler has completed the firing of the given `Trigger` (and the execution of its associated `Job` completed, threw an exception, or was vetoed), and that the ``JobDataMap`` in the given `JobDetail` should be updated if the `Job` is stateful.
`TriggerFiredBundle` | `triggerFired(SchedulingContext ctxt, Trigger trigger)` Inform the `JobStore` that the scheduler is now firing the given `Trigger` (executing its associated `Job`), that it had previously acquired (reserved).

Method Detail

### initialize

    void initialize(ClassLoadHelper loadHelper,
                    SchedulerSignaler signaler)
                    throws SchedulerConfigException

  Called by the QuartzScheduler before the `JobStore` is used, in order to give the it a chance to initialize.

  Throws:
    `SchedulerConfigException`

### schedulerStarted

    void schedulerStarted()
                          throws SchedulerException

  Called by the QuartzScheduler to inform the `JobStore` that the scheduler has started.

  Throws:
    `SchedulerException`

### shutdown

    void shutdown()

  Called by the QuartzScheduler to inform the `JobStore` that it should free up all of it's resources because the scheduler is shutting down.

### supportsPersistence

    boolean supportsPersistence()

### getEstimatedTimeToReleaseAndAcquireTrigger

    long getEstimatedTimeToReleaseAndAcquireTrigger()

  How long (in milliseconds) the `JobStore` implementation estimates that it will take to release a trigger and acquire a new one.

### isClustered

    boolean isClustered()

  Whether or not the `JobStore` implementation is clustered.

### storeJobAndTrigger

    void storeJobAndTrigger(SchedulingContext ctxt,
                            JobDetail newJob,
                            Trigger newTrigger)
                            throws ObjectAlreadyExistsException,
                                   JobPersistenceException

  Store the given ``JobDetail`` and ``Trigger``.

  Parameters:
    `newJob` - The `JobDetail` to be stored.
    `newTrigger` - The `Trigger` to be stored.
  Throws:
    `ObjectAlreadyExistsException` - if a `Job` with the same name/group already exists.
    `JobPersistenceException`

### storeJob

    void storeJob(SchedulingContext ctxt,
                  JobDetail newJob,
                  boolean replaceExisting)
                  throws ObjectAlreadyExistsException,
                         JobPersistenceException

  Store the given ``JobDetail``.

  Parameters:
    `newJob` - The `JobDetail` to be stored.
    `replaceExisting` - If `true`, any `Job` existing in the `JobStore` with the same name & group should be over-written.
  Throws:
    `ObjectAlreadyExistsException` - if a `Job` with the same name/group already exists, and replaceExisting is set to false.
    `JobPersistenceException`

### removeJob

    boolean removeJob(SchedulingContext ctxt,
                      String jobName,
                      String groupName)
                      throws JobPersistenceException

  Remove (delete) the ``Job`` with the given name, and any ``Trigger`` s that reference it.

  If removal of the `Job` results in an empty group, the group should be removed from the `JobStore`'s list of known group names.

  Parameters:
    `jobName` - The name of the `Job` to be removed.
    `groupName` - The group name of the `Job` to be removed.
  Returns:
    `true` if a `Job` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveJob

    JobDetail retrieveJob(SchedulingContext ctxt,
                          String jobName,
                          String groupName)
                          throws JobPersistenceException

  Retrieve the ``JobDetail`` for the given ``Job``.

  Parameters:
    `jobName` - The name of the `Job` to be retrieved.
    `groupName` - The group name of the `Job` to be retrieved.
  Returns:
    The desired `Job`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### storeTrigger

    void storeTrigger(SchedulingContext ctxt,
                      Trigger newTrigger,
                      boolean replaceExisting)
                      throws ObjectAlreadyExistsException,
                             JobPersistenceException

  Store the given ``Trigger``.

  Parameters:
    `newTrigger` - The `Trigger` to be stored.
    `replaceExisting` - If `true`, any `Trigger` existing in the `JobStore` with the same name & group should be over-written.
  Throws:
    `ObjectAlreadyExistsException` - if a `Trigger` with the same name/group already exists, and replaceExisting is set to false.
    `JobPersistenceException`
  See Also:
    `pauseTriggerGroup(SchedulingContext, String)`

### removeTrigger

    boolean removeTrigger(SchedulingContext ctxt,
                          String triggerName,
                          String groupName)
                          throws JobPersistenceException

  Remove (delete) the ``Trigger`` with the given name.

  If removal of the `Trigger` results in an empty group, the group should be removed from the `JobStore`'s list of known group names.

  If removal of the `Trigger` results in an 'orphaned' `Job` that is not 'durable', then the `Job` should be deleted also.

  Parameters:
    `triggerName` - The name of the `Trigger` to be removed.
    `groupName` - The group name of the `Trigger` to be removed.
  Returns:
    `true` if a `Trigger` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### replaceTrigger

    boolean replaceTrigger(SchedulingContext ctxt,
                           String triggerName,
                           String groupName,
                           Trigger newTrigger)
                           throws JobPersistenceException

  Remove (delete) the ``Trigger`` with the given name, and store the new given one - which must be associated with the same job.

  Parameters:
    `triggerName` - The name of the `Trigger` to be removed.
    `groupName` - The group name of the `Trigger` to be removed.
    `newTrigger` - The new `Trigger` to be stored.
  Returns:
    `true` if a `Trigger` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveTrigger

    Trigger retrieveTrigger(SchedulingContext ctxt,
                            String triggerName,
                            String groupName)
                            throws JobPersistenceException

  Retrieve the given ``Trigger``.

  Parameters:
    `triggerName` - The name of the `Trigger` to be retrieved.
    `groupName` - The group name of the `Trigger` to be retrieved.
  Returns:
    The desired `Trigger`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### storeCalendar

    void storeCalendar(SchedulingContext ctxt,
                       String name,
                       Calendar calendar,
                       boolean replaceExisting,
                       boolean updateTriggers)
                       throws ObjectAlreadyExistsException,
                              JobPersistenceException

  Store the given ``Calendar``.

  Parameters:
    `calendar` - The `Calendar` to be stored.
    `replaceExisting` - If `true`, any `Calendar` existing in the `JobStore` with the same name & group should be over-written.
    `updateTriggers` - If `true`, any `Trigger`s existing in the `JobStore` that reference an existing Calendar with the same name with have their next fire time re-computed with the new `Calendar`.
  Throws:
    `ObjectAlreadyExistsException` - if a `Calendar` with the same name already exists, and replaceExisting is set to false.
    `JobPersistenceException`

### removeCalendar

    boolean removeCalendar(SchedulingContext ctxt,
                           String calName)
                           throws JobPersistenceException

  Remove (delete) the ``Calendar`` with the given name.

  If removal of the `Calendar` would result in `Trigger`s pointing to non-existent calendars, then a `JobPersistenceException` will be thrown.

  *

  Parameters:
    `calName` - The name of the `Calendar` to be removed.
  Returns:
    `true` if a `Calendar` with the given name was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveCalendar

    Calendar retrieveCalendar(SchedulingContext ctxt,
                              String calName)
                              throws JobPersistenceException

  Retrieve the given ``Trigger``.

  Parameters:
    `calName` - The name of the `Calendar` to be retrieved.
  Returns:
    The desired `Calendar`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### getNumberOfJobs

    int getNumberOfJobs(SchedulingContext ctxt)
                        throws JobPersistenceException

  Get the number of ``Job`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getNumberOfTriggers

    int getNumberOfTriggers(SchedulingContext ctxt)
                            throws JobPersistenceException

  Get the number of ``Trigger`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getNumberOfCalendars

    int getNumberOfCalendars(SchedulingContext ctxt)
                             throws JobPersistenceException

  Get the number of ``Calendar`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getJobNames

    String[] getJobNames(SchedulingContext ctxt,
                         String groupName)
                         throws JobPersistenceException

  Get the names of all of the ``Job`` s that have the given group name.

  If there are no jobs in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggerNames

    String[] getTriggerNames(SchedulingContext ctxt,
                             String groupName)
                             throws JobPersistenceException

  Get the names of all of the ``Trigger`` s that have the given group name.

  If there are no triggers in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getJobGroupNames

    String[] getJobGroupNames(SchedulingContext ctxt)
                              throws JobPersistenceException

  Get the names of all of the ``Job`` groups.

  If there are no known group names, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggerGroupNames

    String[] getTriggerGroupNames(SchedulingContext ctxt)
                                  throws JobPersistenceException

  Get the names of all of the ``Trigger`` groups.

  If there are no known group names, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getCalendarNames

    String[] getCalendarNames(SchedulingContext ctxt)
                              throws JobPersistenceException

  Get the names of all of the ``Calendar`` s in the `JobStore`.

  If there are no Calendars in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggersForJob

    Trigger[] getTriggersForJob(SchedulingContext ctxt,
                                String jobName,
                                String groupName)
                                throws JobPersistenceException

  Get all of the Triggers that are associated to the given Job.

  If there are no matches, a zero-length array should be returned.

  Throws:
    `JobPersistenceException`

### getTriggerState

    int getTriggerState(SchedulingContext ctxt,
                        String triggerName,
                        String triggerGroup)
                        throws JobPersistenceException

  Get the current state of the identified ``Trigger``.

  Throws:
    `JobPersistenceException`
  See Also:
    `Trigger.STATE_NORMAL`, `Trigger.STATE_PAUSED`, `Trigger.STATE_COMPLETE`, `Trigger.STATE_ERROR`, `Trigger.STATE_NONE`

### pauseTrigger

    void pauseTrigger(SchedulingContext ctxt,
                      String triggerName,
                      String groupName)
                      throws JobPersistenceException

  Pause the ``Trigger`` with the given name.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeTrigger(SchedulingContext, String, String)`

### pauseTriggerGroup

    void pauseTriggerGroup(SchedulingContext ctxt,
                           String groupName)
                           throws JobPersistenceException

  Pause all of the ``Trigger`s` in the given group.

  The JobStore should "remember" that the group is paused, and impose the pause on any new triggers that are added to the group while the group is paused.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeTriggerGroup(SchedulingContext, String)`

### pauseJob

    void pauseJob(SchedulingContext ctxt,
                  String jobName,
                  String groupName)
                  throws JobPersistenceException

  Pause the ``Job`` with the given name - by pausing all of its current `Trigger`s.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeJob(SchedulingContext, String, String)`

### pauseJobGroup

    void pauseJobGroup(SchedulingContext ctxt,
                       String groupName)
                       throws JobPersistenceException

  Pause all of the ``Job`s` in the given group - by pausing all of their `Trigger`s.

  The JobStore should "remember" that the group is paused, and impose the pause on any new jobs that are added to the group while the group is paused.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeJobGroup(SchedulingContext, String)`

### resumeTrigger

    void resumeTrigger(SchedulingContext ctxt,
                       String triggerName,
                       String groupName)
                       throws JobPersistenceException

  Resume (un-pause) the ``Trigger`` with the given name.

  If the `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseTrigger(SchedulingContext, String, String)`

### resumeTriggerGroup

    void resumeTriggerGroup(SchedulingContext ctxt,
                            String groupName)
                            throws JobPersistenceException

  Resume (un-pause) all of the ``Trigger`s` in the given group.

  If any `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseTriggerGroup(SchedulingContext, String)`

### getPausedTriggerGroups

    Set getPausedTriggerGroups(SchedulingContext ctxt)
                               throws JobPersistenceException

  Throws:
    `JobPersistenceException`

### resumeJob

    void resumeJob(SchedulingContext ctxt,
                   String jobName,
                   String groupName)
                   throws JobPersistenceException

  Resume (un-pause) the ``Job`` with the given name.

  If any of the `Job`'s`Trigger` s missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseJob(SchedulingContext, String, String)`

### resumeJobGroup

    void resumeJobGroup(SchedulingContext ctxt,
                        String groupName)
                        throws JobPersistenceException

  Resume (un-pause) all of the ``Job`s` in the given group.

  If any of the `Job` s had `Trigger` s that missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseJobGroup(SchedulingContext, String)`

### pauseAll

    void pauseAll(SchedulingContext ctxt)
                  throws JobPersistenceException

  Pause all triggers - equivalent of calling `pauseTriggerGroup(group)` on every group.

  When `resumeAll()` is called (to un-pause), trigger misfire instructions WILL be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeAll(SchedulingContext)`, `pauseTriggerGroup(SchedulingContext, String)`

### resumeAll

    void resumeAll(SchedulingContext ctxt)
                   throws JobPersistenceException

  Resume (un-pause) all triggers - equivalent of calling `resumeTriggerGroup(group)` on every group.

  If any `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseAll(SchedulingContext)`

### acquireNextTrigger

    Trigger acquireNextTrigger(SchedulingContext ctxt,
                               long noLaterThan)
                               throws JobPersistenceException

  Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.

  Parameters:
    `noLaterThan` - If > 0, the JobStore should only return a Trigger that will fire no later than the time represented in this value as milliseconds.
  Throws:
    `JobPersistenceException`
  See Also:
    `releaseAcquiredTrigger(SchedulingContext, Trigger)`

### releaseAcquiredTrigger

    void releaseAcquiredTrigger(SchedulingContext ctxt,
                                Trigger trigger)
                                throws JobPersistenceException

  Inform the `JobStore` that the scheduler no longer plans to fire the given `Trigger`, that it had previously acquired (reserved).

  Throws:
    `JobPersistenceException`

### triggerFired

    TriggerFiredBundle triggerFired(SchedulingContext ctxt,
                                    Trigger trigger)
                                    throws JobPersistenceException

  Inform the `JobStore` that the scheduler is now firing the given `Trigger` (executing its associated `Job`), that it had previously acquired (reserved).

  Returns:
    null if the trigger or it's job or calendar no longer exist, or if the trigger was not successfully put into the 'executing' state.
  Throws:
    `JobPersistenceException`

### triggeredJobComplete

    void triggeredJobComplete(SchedulingContext ctxt,
                              Trigger trigger,
                              JobDetail jobDetail,
                              int triggerInstCode)
                              throws JobPersistenceException

  Inform the `JobStore` that the scheduler has completed the firing of the given `Trigger` (and the execution of its associated `Job` completed, threw an exception, or was vetoed), and that the ``JobDataMap`` in the given `JobDetail` should be updated if the `Job` is stateful.

  Throws:
    `JobPersistenceException`

### setInstanceId

    void setInstanceId(String schedInstId)

  Inform the `JobStore` of the Scheduler instance's Id, prior to initialize being invoked.

  Since:
    1.7

### setInstanceName

    void setInstanceName(String schedName)

  Inform the `JobStore` of the Scheduler instance's name, prior to initialize being invoked.

  Since:
    1.7

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001-2012, Terracotta, Inc.