定时服务(Timer Service)
EJB3.0的定时服务开发过程:
关键点:首先需要使用容器对象SessionContext创建定时器,然后使用@Timerout声明定时器方法
声明:@Resource SessionContext ctxContext
调用:ctxContext.getTimerService().createTimer(X,X...)
方法规范:在方法上面加上@Timerout要遵循这样的规范:void XXX(Timer timer),在定时器发生时,改方法将被执行
相关代码:
posted on 2012-01-21 10:12 Alan's Blog 阅读(1379) 评论(0) 编辑 收藏 举报