+

Search Tips   |   Advanced Search

Scheduler calendars

The scheduler provides stateless session bean interfaces which allow creating common calendars which can be used by the scheduler and any JEE (Java EE) application.

The SchedulerCalendars.ear application is available and provides a default UserCalendar Enterprise Java Beans (EJB) implementation which allows using the SIMPLE and CRON calendars. Although this application is not required when using the scheduler, it is available to use from any Java EE application.

For details on how the SIMPLE and CRON calendars behave, see the API documentation for the com.ibm.websphere.scheduler.UserCalendar interface.


Specify a UserCalendar with the scheduler

A UserCalendar is specified using the setUserCalendar() method of the TaskInfo interface of the scheduler. This interface allows you to select the JNDI name of the home interface of a UserCalendar bean. Because some UserCalendar bean implementations might handle multiple types of calendars, the interface also allows us to optionally select which type of calendar to use. A list of valid calendar types can be retrieved by invoking the getCalendarNames() method of the UserCalendar interface.

If the setUserCalendar() method is not invoked, or if a value of null or empty-string is specified for the home JNDI name parameter, then the default UserCalendar is used internally by the scheduler. When the default UserCalendar is accessed internally, it is not necessary that the SchedulerCalendars.ear system application be installed.To use the default UserCalendar with a CRON entry, you must switch to the CRON entry manually. The following code sample shows this switch:

BeanTaskInfo taskInfo = (BeanTaskInfo)scheduler.createTaskInfo(BeanTaskInfo.class);
String calendarVariant = "CRON";
taskInfo.setUserCalendar(null, calendarVariant);
// cron table entry
String cronTableEntry = "0 17,20,23 * ? * *";
taskInfo.setStartTimeInterval(cronTableEntry);

We might want to use the default UserCalendar directly in our other Java EE applications, apart from the scheduler. In this case, you may use the UserCalendarHome.DEFAULT_CALENDAR_JNDI_NAME value to look up the default UserCalendar from the applications. You may also supply this value to the setUserCalendar() method of the TaskInfo interface. You will need to ensure the SchedulerCalendars.ear system application was either automatically installed or that we have installed it manually.


Related tasks

  • Install default scheduler calendars
  • Example: Use default scheduler calendars
  • Configure schedulers
  • Develop and scheduling tasks

  • Schedulers collection


    Related information:

  • Example: Stopping and starting scheduler daemons using JMX API
  • Example: Dynamically changing scheduler daemon poll intervals using JMX API Concept topic