WebSphere Application Server Network Deployment, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Scheduling long-running tasks

Why and when to perform this task

The scheduler’s default behavior is designed to run business logic that runs for a short period of time. Version 6.0.2 provides two new API methods on the com.ibm.websphere.scheduler.TaskInfo interface that help avoid some of the problems that can occur when running tasks for a long period of time.

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

The TaskInfo.setExpectedDuration method allows the scheduler to adjust timeout values as appropriate for a given task for all qualities of service. The application server will attempt to adjust various run-time parameters to accommodate the task’s estimated run time.

Steps for this task

  1. When assembling the TaskInfo object using 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 task’s expected duration in seconds.
  2. Schedule the task using the Scheduler.create method.



Related concepts
Transactions and schedulers

Related reference
Reference: Generated API documentation

Task topic    

Terms of Use | Feedback

Last updated: Mar 17, 2005 4:28:29 AM CST
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/scheduler/tasks/tsch_longtasks.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)