【问题标题】:Timer Service to run everyday 5 AM每天早上 5 点运行的定时器服务
【发布时间】:2015-10-22 16:18:32
【问题描述】:

以下是我目前每 5 分钟运行一次的代码。每天早上 5 点有人帮忙设置。

timerService.createTimer(invokeTime,
                5*60*1000, ProgramParticipantManagerBean.class.getName());

【问题讨论】:

  • 有什么问题? “有人帮忙”不是很具体,您到底遇到了什么问题?

标签: java ejb ejb-3.0


【解决方案1】:

一种方法是您可以使用ScheduleExpression,如下所示:

ScheduleExpression schedule = new ScheduleExpression();
schedule.dayOfWeek("[0,7]");
schedule.hour("05");
Timer timer = timerService.createCalendarTimer(schedule);

或者使用@Schedules注解。

查看更多

【讨论】:

  • EJB 不支持 ScheduleExpression 和 createCalendarTimer。它只支持 createTimer
  • 在哪个容器上?您没有提供任何可以帮助任何人有效帮助您的信息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-04-02
  • 2014-07-18
  • 1970-01-01
  • 2022-01-12
  • 2015-12-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多