Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Scheduler service > Scheduling tasks


Schedule long-running tasks

The default behavior of the scheduler is designed to run business logic that runs for a short period of time. In version 6.0.2 and later, two API methods on the com.ibm.websphere.scheduler.TaskInfo interface help avoid some of the problems that can occur when running tasks for an extended time.

The TaskInfo.setQOS method supports tasks with both a transactional and non-transactional quality of service. When running tasks that run for long periods, you can use the TaskInfo.QOS_ATLEASTONCE quality of service to run the task without a global transaction. This process prevents various timeout issues that can occur when resources are held by a long-running transaction. See the Transactions and schedulers topic for details on the TaskInfo.setQOS method and how it can be used.

Use the TaskInfo.setExpectedDuration method, the scheduler can to adjust timeout values, as appropriate, for a given task for all qualities of service. The application server attempts to adjust various run-time parameters to accommodate the estimated run time of the task.


Procedure

  1. When you assemble the TaskInfo object with the Scheduler API or the WASScheduler MBean, use the following methods on the TaskInfo interface:

    1. Set the quality of service.

      1. If the task must be transactional, use the setQOS method with the QOS_ONLYONCE constant, which is the default, if not set.

      2. If the task does not need to be transactional, use the setQOS method with the QOS_ATLEASTONCE constant.

    2. Set the expected duration.

      1. Use the setExpectedDuration method to set the expected duration of the task in seconds.

  2. Schedule the task using the Scheduler.create method.


What to do next

View the Access schedulers topic.
Transactions and schedulers
Access schedulers


Related


Additional Application Programming Interfaces (APIs)

+

Search Tips   |   Advanced Search