示例:使用缺省调度程序日历

您可以从任何 J2EE 应用程序使用 SIMPLE 和 CRON 日程表。

使用缺省调度程序日程表涉及查询缺省 UserCalendarHome Enterprise JavaBeans (EJB) Home 对象、创建 UserCalendar Bean 和调用 applyDelta() 方法。有关 applyDelta 方法的详细信息以及 SIMPLE 和 CRON 日历的语法,请参阅 UserCalendar 接口主题。

示例:

import java.util.Date;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import com.ibm.websphere.scheduler.UserCalendar;
import com.ibm.websphere.scheduler.UserCalendarHome;

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

// Lookup and narrow the default UserCalendar home.
UserCalendarHome defaultCalHome=(UserCalendarHome)
	PortableRemoteObject.narrow(ctx.lookup(
      UserCalendarHome.DEFAULT_CALENDAR_JNDI_NAME), 
	   UserCalendarHome.class);

// 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");

指示主题类型的图标 参考主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tsch_usingcalendar
文件名:tsch_usingcalendar.html