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.plugins
Class SchedulerPluginWithUserTransactionSupport

    java.lang.Object
      org.quartz.plugins.SchedulerPluginWithUserTransactionSupport

All Implemented Interfaces:
  SchedulerPlugin

Direct Known Subclasses:
  XMLSchedulingDataProcessorPlugin

    public abstract class SchedulerPluginWithUserTransactionSupport

extends Object
implements SchedulerPlugin

Base class for plugins that wish to support having their start and shutdown methods run within a `UserTransaction`. This is often necessary if using the JobStoreCMT and the plugin interacts with jobs/triggers.

The subclass should implement start(UserTransaction) and shutdown(UserTransaction). The `UserTransaction` will be non-null if property wrapInUserTransaction is set to true.

For convenience, this base class also provides an initialize() implementation which saves the scheduler and plugin name, as well as getLog() for logging.

Constructor Summary
`SchedulerPluginWithUserTransactionSupport()`

Method Summary
`protected org.slf4j.Logger` | `getLog()` Get the commons Logger for this class.
`protected String` | `getName()` Get the name of this plugin.
`protected Scheduler` | `getScheduler()` Get this plugin's `Scheduler`.
`boolean` | `getWrapInUserTransaction()` Wrap the start() and shutdown() methods in a UserTransaction.
`void` | `initialize(String name, Scheduler scheduler)` Called during creation of the `Scheduler` in order to give the `SchedulerPlugin` a chance to initialize.
`void` | `setWrapInUserTransaction(boolean wrapInUserTransaction)` Wrap the start() and shutdown() methods in a UserTransaction.
`void` | `shutdown()` Based on the value of wrapInUserTransaction, wraps the call to shutdown(UserTransaction) in a UserTransaction.
`protected void` | `shutdown(UserTransaction userTransaction)` Called in order to inform the `SchedulerPlugin` that it should free up all of it's resources because the scheduler is shutting down.
`void` | `start()` Based on the value of wrapInUserTransaction, wraps the call to start(UserTransaction) in a UserTransaction.
`protected void` | `start(UserTransaction userTransaction)` Called when the associated `Scheduler` is started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SchedulerPluginWithUserTransactionSupport

    public SchedulerPluginWithUserTransactionSupport()

Method Detail

### start

    protected void start(UserTransaction userTransaction)

  Called when the associated `Scheduler` is started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.

  If UserTransaction is not null, the plugin can call setRollbackOnly() on it to signal that the wrapped transaction should rollback.

  Parameters:
    `userTransaction` - The UserTranaction object used to provide a transaction around the start() operation. It will be null if wrapInUserTransaction is false or if the transaction failed to be started.

### shutdown

    protected void shutdown(UserTransaction userTransaction)

  Called in order to inform the `SchedulerPlugin` that it should free up all of it's resources because the scheduler is shutting down.

  If UserTransaction is not null, the plugin can call setRollbackOnly() on it to signal that the wrapped transaction should rollback.

  Parameters:
    `userTransaction` - The UserTranaction object used to provide a transaction around the shutdown() operation. It will be null if wrapInUserTransaction is false or if the transaction failed to be started.

### getLog

    protected org.slf4j.Logger getLog()

  Get the commons Logger for this class.

### getName

    protected String getName()

  Get the name of this plugin. Set as part of initialize().

### getScheduler

    protected Scheduler getScheduler()

  Get this plugin's `Scheduler`. Set as part of initialize().

### initialize

    public void initialize(String name,
                           Scheduler scheduler)
                    throws SchedulerException

  Description copied from interface: `SchedulerPlugin`

  Called during creation of the `Scheduler` in order to give the `SchedulerPlugin` a chance to initialize.

  At this point, the Scheduler's `JobStore` is not yet initialized.

  If you need direct access your plugin, for example during `Job` execution, you can have this method explicitly put a reference to this plugin in the `Scheduler`'s `SchedulerContext`.

  Specified by:
    `initialize` in interface `SchedulerPlugin`
  Parameters:
    `name` - The name by which the plugin is identified.
    `scheduler` - The scheduler to which the plugin is registered.
  Throws:
    `SchedulerConfigException` - if there is an error initializing.
    `SchedulerException`

### getWrapInUserTransaction

    public boolean getWrapInUserTransaction()

  Wrap the start() and shutdown() methods in a UserTransaction. This is necessary for some plugins if using the JobStoreCMT.

### setWrapInUserTransaction

    public void setWrapInUserTransaction(boolean wrapInUserTransaction)

  Wrap the start() and shutdown() methods in a UserTransaction. This is necessary for some plugins if using the JobStoreCMT.

### start

    public void start()

  Based on the value of wrapInUserTransaction, wraps the call to start(UserTransaction) in a UserTransaction.

  Specified by:
    `start` in interface `SchedulerPlugin`

### shutdown

    public void shutdown()

  Based on the value of wrapInUserTransaction, wraps the call to shutdown(UserTransaction) in a UserTransaction.

  Specified by:
    `shutdown` in interface `SchedulerPlugin`

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.