A scheduler 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 the Interface Scheduler
in the Javadoc.
- Task creation
- The task is created in the persistent store using
the caller's global transactional context if present. See the topic Transactions and the scheduler service 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 does not block on the attempt, but a TaskPending exception
is thrown. The operation can be reattempted at another time. Tasks can only
be modified by the same application (EAR file) that was used to create the
task.
- Task execution
- Tasks are executed in the thread pool specified
by the configuration's work manager, under the security ID of the task creator.
If multiple schedulers are configured to share the same database table, the
tasks found in the table can be executed 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.