Scheduler interface
Use the com.ibm.websphere.scheduler.Scheduler Java object (in the Java Naming and Directory Interface (JNDI) namespace for the scheduler configuration) to find a reference to a scheduler and work with tasks.
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 we need to modify a group of tasks and tracking individual task ID's is not convenient.
- TaskInfo interface
TaskInfo objects contain the information to create a task. Several implementations of this class exist, one for each type of task that can run.
- TaskHandler interface
A task handler is a user-defined stateless session bean that is called by tasks created using a BeanTaskInfo object.
- NotificationSink interface
A notification sink is a user-defined stateless session bean that is called when the task changes state.
- UserCalendar interface
A user calendar is a user-defined stateless session bean that is called by tasks when they need to calculate date-related values.
Related tasks
Develop and scheduling tasks Manage schedulers
API documentation Reference topic