How to get all EJB timers?

后端 未结 4 514
我在风中等你
我在风中等你 2021-01-11 22:37

In EJB 3.1 I can get all timers for a specific bean using TimerService#getTimers() on the TimerService instance obtained for that bean.

What I actually need however

4条回答
  •  无人及你
    2021-01-11 22:56

    You can only see timers of your own class. With the EJB Scheduler you can't list all timers of your application.

    @Resource
    private TimerService timerService;
    
    for (Timer timer : timerService.getTimers()) {
        // do anything
    }
    

    With Quartz you can via Scheduler.getJobNames/triggerNames for all jobs/triggers of you application.

提交回复
热议问题