|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.scheduledjobs.ScheduledJob
public abstract class ScheduledJob
Abstract ancestor for scheduled jobs.
ScheduledJob(s) can be configured as Quartz-based Jobs or as Runnable(s). ScheduledJob(s) implement the org.quartz.StatefulJob and Runnable interfaces. ScheduledJob(s) include a method named executeJob(), which descendents override to do real work. When configured as a Quartz Job, org.quartz.Job#execute() invokes executeJob(). When configured as a Runnable job, run() invokes executeJob(). Generally, ScheduledJob(s) are used by the framework to poll external systems for data and send messages to an osESB transport handler for processing. ScheduledJob(s) are therefore useful in situations where an external system cannot send messages to osESB directly, but instead, generates events for processing by osESB. Out of the box, there are ScheduledJob classes that poll databases, JMS Destinations, and file systems for changes and send messages to an osESB transport handler for processing. Current ScheduledJob classes include:<displayStartupMessageFlag>, which determines if a startup
message is logged when ScheduledJobManager starts a ScheduledJob<heartbeatInterval>, if set, a heartbeat message is logged
every heartbeatInterval seconds. The heartbeat message is a health check
for the ScheduledJob and the heartbeatInterval is independent of the job
repeat interval or cron specification. The schedule configuration is used
by ScheduledJobManager to configure and start a ScheduledJob.<schedule-configuration>, which includes the repeat interval
for periodic jobs OR a cron expression for Quartz-based cron jobs. Periodic
jobs start executing when the first interval after the job start time
expires and then repeat indefinitely. Cron jobs are executed according
to the configured cron expression.<job-configuration>, which contains the application-specific
properties that are required to execute the job. The <job-config-class>
element determines the class that is loaded for the job configuration.
The job configuration class defaults to XMLConfiguration.
| Field Summary | |
|---|---|
static java.lang.String |
JOBDATA_MAP_KEY_JOBNAME
Job property key for the name of the Job. |
static java.lang.String |
JOBDATA_MAP_KEY_JOBSTARTEDTIMESTAMP
Job property key for the java.util.Date the Job was started. |
static java.lang.String |
JOBDATA_MAP_KEY_JOBTYPE
Job property key for the Job type, which is either 'quartz' or 'runnable'. |
static java.lang.String |
JOBDATA_MAP_KEY_LASTHEARTBEATTIMESTAMP
Job property key for the java.util.Date for the last time a heartbeat message was logged. |
static java.lang.String |
JOBDATA_MAP_KEY_LASTJOBTIMESTAMP
Job property key for the java.util.Date for the last time job was run. |
static java.lang.String |
JOBDATA_MAP_KEY_NUMBEROFTIMESEXECUTEJOB
Job property key for the Integer number of times the job was run. |
protected org.quartz.JobExecutionContext |
jobExecutionContext
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
protected java.util.Map |
jobPropertyMap
A Map of job properties, which is used to maintain job statistics. |
protected java.lang.Thread |
jobThread
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
protected boolean |
jobThreadStopping
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
protected java.lang.String |
jobType
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
protected static org.apache.commons.logging.Log |
log
The logging implementation for this class. |
static java.lang.String |
QUARTZ_JOB_TYPE
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
static java.lang.String |
RUNNABLE_JOB_TYPE
ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). |
protected ScheduledJobConfiguration |
scheduledJobConfiguration
The ScheduledJobConfiguration for this ScheduledJob. |
protected java.lang.String |
thisClassName
The full name of this class. |
| Constructor Summary | |
|---|---|
ScheduledJob()
Creates a new, uninitalized instance of ScheduledJob. |
|
ScheduledJob(ScheduledJobConfiguration scheduledJobConfiguration)
Creates a new, uninitalized instance of ScheduledJob. |
|
| Method Summary | |
|---|---|
void |
execute(org.quartz.JobExecutionContext context)
org.quartz.Job interface. |
void |
executeJob()
Execute the ScheduledJob according to the ScheduledJobConfiguration. |
java.util.Map |
getJobPropertyMap()
Return a Map of job properties, which is used to maintain job statistics. |
java.lang.String |
getJobType()
Return the jobType for this ScheduledJob. |
ScheduledJobConfiguration |
getScheduledJobConfiguration()
Returns the ScheduledJobConfiguration for this ScheduledJob. |
void |
incrementJobStatistics()
Increment job statistics. |
void |
joinJobThread()
Wait indefinitely for jobThread to die. |
void |
joinJobThread(long millis)
Waits at most millis milliseconds for jobThread thread to die. |
boolean |
logHeartbeatMessage()
Log the heartbeat message if configured by the <heartbeatInterval> property in the
ScheduledJobConfiguration. |
static java.lang.String |
logMessage(java.lang.String messageText,
ScheduledJob scheduledJob)
Constructs and returns a message for Exceptions and logs. |
void |
run()
Run the ScheduledJob thread. |
void |
start()
Start a Runnable ScheduledJob. |
void |
stop()
Stop a Runnable ScheduledJob. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected java.lang.String thisClassName
protected ScheduledJobConfiguration scheduledJobConfiguration
<displayStartupMessageFlag>, which determines if a startup message is logged
when ScheduledJobManager starts a ScheduledJob<heartbeatInterval>, if set, a heartbeat message is logged every
heartbeatInterval seconds.<schedule-configuration>, which includes the repeat interval for periodic jobs
OR a cron expression for Quartz-based cron jobs. Periodic jobs start executing when the
first interval after the job start time expires and then repeat indefinitely. Cron jobs
are executed according to the configured cron expression. The schedule configuration
is used by ScheduledJobManager to configure and start a ScheduledJob.<job-configuration>, which contains the application-specific properties
that are required to execute the job. The <job-config-class> element determines
the class that is loaded for the job configuration. The job configuration class defaults
to XMLConfiguration.
protected org.quartz.JobExecutionContext jobExecutionContext
start(),
stop(),
run()protected java.lang.Thread jobThread
start(),
stop(),
run()protected boolean jobThreadStopping
start(),
stop(),
run()protected java.util.Map jobPropertyMap
incrementJobStatistics(),
logHeartbeatMessage()protected java.lang.String jobType
getJobType()public static java.lang.String QUARTZ_JOB_TYPE
getJobType()public static java.lang.String RUNNABLE_JOB_TYPE
getJobType()public static final java.lang.String JOBDATA_MAP_KEY_JOBNAME
public static final java.lang.String JOBDATA_MAP_KEY_JOBTYPE
public static final java.lang.String JOBDATA_MAP_KEY_JOBSTARTEDTIMESTAMP
public static final java.lang.String JOBDATA_MAP_KEY_NUMBEROFTIMESEXECUTEJOB
public static final java.lang.String JOBDATA_MAP_KEY_LASTJOBTIMESTAMP
public static final java.lang.String JOBDATA_MAP_KEY_LASTHEARTBEATTIMESTAMP
| Constructor Detail |
|---|
public ScheduledJob()
public ScheduledJob(ScheduledJobConfiguration scheduledJobConfiguration)
throws java.lang.Exception
scheduledJobConfiguration - The ScheduledJobConfiguration for this ScheduledJob.
java.lang.Exception - if constructed with a null scheduledJobConfiguration.| Method Detail |
|---|
public void execute(org.quartz.JobExecutionContext context)
throws org.quartz.JobExecutionException
execute in interface org.quartz.Jobcontext - The Quartz JobExecutionContext.
org.quartz.JobExecutionException - if a ScheduledJobConfiguration cannot be retrieved
from the Quartz JobDataMap.Job.execute(org.quartz.JobExecutionContext)public void run()
run in interface java.lang.Runnablestart(),
stop()
public void executeJob()
throws java.lang.Exception
java.lang.Exception - org.quartz.JobExecutionException
if there is a problem completing the executeJob()
method.public void start()
public void stop()
public void joinJobThread()
public void joinJobThread(long millis)
public void incrementJobStatistics()
logHeartbeatMessage()public boolean logHeartbeatMessage()
<heartbeatInterval> property in the
ScheduledJobConfiguration.
<heartbeatInterval>
is configured and if the configured <heartbeatInterval> has
elapsed.public ScheduledJobConfiguration getScheduledJobConfiguration()
<displayStartupMessageFlag>, which determines if a startup message is logged
when ScheduledJobManager starts a ScheduledJob<heartbeatInterval>, if set, a heartbeat message is logged every
heartbeatInterval seconds.<schedule-configuration>, which includes the repeat interval for periodic jobs
OR a cron expression for Quartz-based cron jobs. Periodic jobs start executing when the
first interval after the job start time expires and then repeat indefinitely. Cron jobs
are executed according to the configured cron expression. The schedule configuration is
used by ScheduledJobManager to configure and start a ScheduledJob.<job-configuration>, which contains the application-specific properties that are
required to execute the job. The <job-config-class> element determines the class
that is loaded for the job configuration. The job configuration class defaults to XMLConfiguration.
public java.util.Map getJobPropertyMap()
incrementJobStatistics(),
logHeartbeatMessage()public java.lang.String getJobType()
public static java.lang.String logMessage(java.lang.String messageText,
ScheduledJob scheduledJob)
messageText - The basic message text.scheduledJob - The ScheduledJob that will log the message.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||