A com.ibm.websphere.scheduler.Scheduler Java object exists
in the JNDI namespace for each scheduler configuration. A reference to a scheduler
can be obtained by performing a lookup on the JNDI name; however, the lookup
is valid only from the server process where the scheduler instance exists.
Once a reference has been obtained, tasks can be created, suspended, cancelled,
and so on, if the caller has access to the scheduler instance.
For details,
see Interface Scheduler in the API documentation.
- Task creation
- The task is created in the persistent store using the global transactional
context of the caller, if present. See the topic, Transactions and schedulers, for more details. Since this is a transactional
operation, the task cannot be run or modified from another thread until the
current transaction commits.
- Task modification
- Tasks that have been created can be modified with the suspend(), resume(),
cancel(), and purge() methods. These methods take a Task Identifier string
as a parameter, which is generated by the create() method and can be found
in the TaskStatus object. If a task is currently running or being modified
by another thread, an operation that attempts to modify the state of the task
might block on the attempt. Tasks can only be modified by the same application
(EAR file) that was used to create the task.
- Task execution
- Tasks are run in the thread pool specified by the configuration's work
manager. If multiple schedulers are configured to share the same database
tables, the scheduler is clustered and the tasks found in the table can be
run on any of the schedulers, whether or not they are in the same server,
node, or cell.
- Task lookup
- Tasks can be located using the Name property that was assigned at creation
time. This is useful when you need to modify a group of tasks and tracking
individual task ID's is not convenient.