public abstract class SchedulerPluginWithUserTransactionSupport extends java.lang.Object implements SchedulerPlugin
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 and Description |
---|
SchedulerPluginWithUserTransactionSupport() |
Modifier and Type | Method and Description |
---|---|
boolean |
getWrapInUserTransaction()
Wrap the start() and shutdown() methods in a UserTransaction.
|
void |
initialize(java.lang.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.
|
void |
start()
Based on the value of wrapInUserTransaction, wraps the
call to start(UserTransaction) in a UserTransaction.
|
public SchedulerPluginWithUserTransactionSupport()
public void initialize(java.lang.String name, Scheduler scheduler) throws SchedulerException
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
.
initialize
in interface SchedulerPlugin
name
- The name by which the plugin is identified.scheduler
- The scheduler to which the plugin is registered.SchedulerConfigException
- if there is an error initializing.SchedulerException
public boolean getWrapInUserTransaction()
public void setWrapInUserTransaction(boolean wrapInUserTransaction)
public void start()
start
in interface SchedulerPlugin
public void shutdown()
shutdown
in interface SchedulerPlugin