WebSphere Application Server Enterprise Edition V5, V5.1 Scheduler Service FAQ
 Technote (troubleshooting)
 
Problem(Abstract)
Frequently asked questions for the Schedule Service of IBM® WebSphere® Application Server Enterprise Edition V5 and V5.1.
 
Symptom
 
Resolving the problem
  1. Can a currently-running task be suspended?

    Use Scheduler.suspend(taskid) to suspend a running task.

    If a task is currently running, however, the method blocks until either the running task completes or the database cancels the suspend request. If the request is cancelled, a TaskPending exception is issued. The Scheduler relies on database locks to maintain a run-only-once guarantee.

  2. Why does a running task return a status of scheduled instead of running?

    The database is always updated with the next state prior to firing the task. Therefore, the task always is SCHEDULED, INVALID, COMPLETE or CANCELLED. RUNNING is not currently used. It is reserved for future use.

  3. What are the properties that can be modified for a scheduled task that has not yet started?

    An application that tries to change the name of a task gets an exception. It is necessary to purge the task to change the properties of a scheduled task.

    The Scheduler does not currently support updating the properties of existing tasks. You can change only the state; for example, suspend or resume. If you want to modify a task, you can imply:

    TaskInfo ti = s.getTask(tid);
    s.cancel(ti, false); // purge is optional.
    ti.setName(newname);
    TaskStatus ts = s.schedule(ti);
    String newTID = ts.getTaskID(); // A new ID is assigned.

  4. What is StartTimeInterval and how is it used when creating a task?

    The startTimeInterval is the same as the startTime, except it uses the calendar. For example, if it is 1:00 PM and you want your task to start at 2:00 PM, you can start it one of two ways:

    1. setStartTime(new Date(2004,5,23,14,0));

    2. setStartTimeInterval("1hours");
      If setUserCalendar is not set, the SIMPLE default UserCalendar is used; refer to the following Information Center javadoc for com.ibm.websphere.scheduler.UserCalendar for syntax.

      After the first start time is set using setStartTime or setStartTimeInterval completes, the repeat interval is used to calculate subsequent times.

  5. What is the repeat Interval?

    The repeatInterval is the time between fire times. If the startTime is not specified, the first fire time is current time+interval. If you specify a start time, the specified time is the first fire time. Then, each subsequent fire time is based on the fire time of the task.

    If you want the task to execute every day at a particular time, use CRON instead of the SIMPLE calendar. The SIMPLE calendar causes the fire times to potentially drift in the event the task is delayed.

    Setting the CRON/SIMPLE calendar

    If you are using WebSphere Application Server V5.0.2, you can use the internal calendar as follows:

    TaskInfo.setUserCalendar(null, "CRON");

    If you are using WebSphere Application Server V5.0 or V5.0.1, you must set the JNDI name of the SchedulerCalendar bean as follows:

    TaskInfo.setUserCalendar(UserCalendarHome.DEFAULT_CALENDAR_JNDI_NAME, "CRON");

    Example:

    Setting up a job to start everyday by 5:05:00 AM

    Set the repeatInterval as follows:
    "0 5 5 * * ? "

If the current time is 17:00:00 2004/06/14 when the task is scheduled, the first fire time is calculated as 05:05:00 2004/06/15. The start-by interval is based on the next fire time, so it is 05:05:00 2004/06/15, which is the next available time slot that comes after the fire time.

If the task is over 24 hours late and does not fire until 05:06:00 2004/06/15, that occurrence is skipped. The next time is calculated based on the current time, and the task is rescheduled for that time. In this case, the task is delayed by one day: 05:00:00 2004/06/16 with a start-by time of 05:05:00 2004/06/16.
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Enterprise Edition (EE)
Operating system(s): Windows
Software version: 5.2
Software edition:
Reference #: 1176221
IBM Group: Software Group
Modified date: Aug 17, 2004