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

Scheduling tasks

To develop and schedule tasks, use a configured scheduler.


  1. Look up a configured scheduler. Refer to the Accessing schedules topic. Each configured scheduler is available from two different programming models:

    • A Java EE server application, such as a servlet or EJB component, can use the Scheduler API. Schedulers are accessed by looking them up using a JNDI name or resource reference.
    • Java Management Extensions (JMX) applications, such as wsadmin scripts, can use the Scheduler API using WASScheduler MBeans.

  2. Develop the task.

    The Scheduler API supports different implementations of the TaskInfo interface, each of which can be used to schedule a particular type of work. Refer to the Developing a task that calls a session bean topic and Develop a task that sends a JMS message topic for details. The task object that is referenced in the Develop a task that sends a JMS message topic can send a JMS message to either a queue or a topic.

    Attention: Creating and manipulating scheduled tasks through the Scheduler interface is only supported from within the EJB container or Web container (Enterprise beans or servlets). Looking up and using a configured scheduler from a Java EE application client container is not supported.

  3. Receive scheduler notifications. A notification sink is set on a task in order to receive the notification events that are generated by a scheduler when it performs an operation on the task.

  4. Use custom calendars. You can assign a UserCalendar session bean to a task that allows schedulers to use custom and predefined date algorithms to determine when a task should run. Refer to the UserCalendar interface topic for details.
  5. Submit tasks to a scheduler. After a TaskInfo object has been created, it can be submitted to the scheduler for task creation by calling the Scheduler.create() method.
  6. Manage tasks with a scheduler.
  7. Secure tasks with a scheduler.


We can use the SIMPLE and CRON calendars from any Java EE application. This example illustrates the process.

Use default scheduler calendars. The following code examples illustrates how to use connections correctly and incorrectly.

Use default scheduler calendars involves looking up the default UserCalendarHome EJB home object, creating the UserCalendar bean and calling the applyDelta() method. For details on the applyDelta method as well as the syntax for the SIMPLE and CRON calendars, see UserCalendar interface topic.

import java.util.Date;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

// Create an initial context
InitialContext ctx = new InitialContext();

// Lookup and narrow the default UserCalendar home.
UserCalendarHome defaultCalHome=(UserCalendarHome)

// Create the default UserCalendar instance.
UserCalendar defaultCal = defaultCalHome.create();

// Calculate a date using CRON based on the current
// date and time.  Return the next date that is
// Saturday at 2AM
Date newDate =
    defaultCal.applyDelta(new Date(),
        "CRON", "0 0 2 ? * SAT");


Access schedulers
Develop a task that calls a session bean
Develop a task that sends a JMS message
Schedule long-running tasks
Receive scheduler notifications
Submit a task to a scheduler
Task management methods using a scheduler
Identify tasks that are currently running
Stop tasks that are failing
Scheduler tasks and Java EE context
Secure scheduler tasks
Scheduler configuration or topology
Scheduler interface
Manage schedulers


MBean API documentation


Search Tips   |   Advanced Search