Java EE调度程序未被调用 [英] Java EE Scheduler is not called

查看:138
本文介绍了Java EE调度程序未被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Glassfish中运行我的应用程序。我尝试创建一个作业,每5分钟执行一次,如下所示:

  @Startup 
@Singleton
@LocalBean
public class TempFolderCleaner {
private final static Logger LOGGER = LoggerFactory.getLogger(TempFolderCleaner.class);

@EJB
私人ReportStatusDao reporStatusDao;

@Schedule(minute =* / 5)
public void removeOldReports(){
LOGGER.debug(start removeOldReports());
}
}

但是,它永远不会被调用。我试图从记录器中看到一条消息并设置一个调试点,但它不会被调用。
我用这个文档的语法: http://download.oracle.com/ javaee / 6 / tutorial / doc / bnboy.html



我也尝试完全指定分钟数。不幸的是,没有成功。

解决方案

我认为小时默认为0(午夜),所以你可能需要指定它为:

  @Schedule(minute =* / 5,hour =*)


I'm running my application inside Glassfish. I tried to create a job, which will be executed every 5 minutes like this:

@Startup
@Singleton
@LocalBean
public class TempFolderCleaner {
    private final static Logger LOGGER = LoggerFactory.getLogger(TempFolderCleaner.class);

    @EJB
    private ReportStatusDao reporStatusDao;

    @Schedule(minute = "*/5")
    public void removeOldReports() {
        LOGGER.debug("start removeOldReports()");
    }
}

However, it is never called. I tried to see a message from the logger and to set a debug point but it won't be called. I used this documentation for the syntax: http://download.oracle.com/javaee/6/tutorial/doc/bnboy.html

I also tried to specify the minutes exactly. Unfortunately without success either.

解决方案

I think "hour" defaults to 0 (midnight), so you might need to specify it as:

@Schedule(minute = "*/5", hour="*")

这篇关于Java EE调度程序未被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆