|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
JobManager
.
See
Description
Interface Summary | |
---|---|
JobContext | Holds information about a job and an implementation of this is passed to the work manager to execute. |
JobDefinition | An abstract job definition interface. |
JobManager | The JobManager interface provides for managing (CRUD)
job definitions, scheduling jobs and managing their run histories. |
Enum Summary | |
---|---|
JobDefinition.JOB_TYPE | Supported job types. |
JobManager.JOB_STATUS | All the states a job can be in. |
This package provides interfaces and classes for creating and scheduling jobs using JobManager
.
The jobs are created by implementing one of the job interfaces TimerJob
, IntervalJob
,EventJob
, CalendarJob
or StartupJob
. The jobs can be scheduled to run by creating job definitions. The job definitions are created
from a configuration file job-manager-config.xml or by using job manager API. The job-manager-config.xml
should be placed under [Application Root]/META-INF
for application scoped job definitions or
[Web Application Root]/WEB-INF
directory for web app scoped job definitions.
Each job definition can also register a job listener to get callbacks on job completion or on job failure
by implementing JobListener
interface and including it as part of job definition configuration.
Example of creating a job and configuring it in job-manager-config.xml
TimerJob
, IntervalJob
,EventJob
, CalendarJob
or StartupJob
.
<?xml version="1.0"?> <job-manager-config xmlns="http://www.bea.com/ns/p13n/10_1/job-manager-config"> <interval-job-definition> <name>TestJob</name> <group>TestJobGroup</group> <job-class>com.test.job.TestJob</job-class> <interval>5</interval> </interval-job-definition> </job-manager-config>
The job-manager-config.xml is placed under [Application Root]/META-INF
if the job needs
to run under application scope or [Web Application Root]/WEB-INF
if the job needs to run
under web application scope (or requires servlet context).
Example of creating a job using the job manager API
TimerJob
, IntervalJob
,EventJob
, CalendarJob
or StartupJob
.
JobManagerService
.
// Retrieve JobManagerService JobManagerService jobManagerService = com.bea.wlp.services.Services.getService(JobManagerService.class); // Get web application scoped job manager instance JobManager jobManager = jobManagerService.getJobManager(servletContext); OR // Get application scoped job manager instance JobManager jobManager = jobManagerService.getJobManager();
// Create interval job definition IntervalJobDefinition interval = new IntervalJobDefinition("TestJob"); interval.setGroup("TestJobGroup"); interval.setJobClass("com.test.job.TestJob"); interval.setInterval(5); jobManager.createJobDefinition(interval);
Notes:
JobManager
,
JobManagerService
,
TimerJob
,
IntervalJob
,
CalendarJob
,
EventJob
,
StartupJob
,
JobListener
,
TimerJobDefinition
,
IntervalJobDefinition
,
CalendarJobDefinition
,
EventJobDefinition
,
StartupJobDefinition
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |