How to get all EJB timers?

后端 未结 4 482
我在风中等你
我在风中等你 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:49

    Below is the sample code fragment for fetching information of all the existing timers of the system.

    //---
    
    private void viewSystemTimers(){
    
            Collection allTimers = sessionContext.getTimerService().getTimers();
    
            Iterator iterator = allTimers.iterator();
    
            while (iterator.hasNext()) {
    
                Timer timer = (Timer) iterator.next();
    
                System.out.println("SYSTEM TIMER : "+timer.getInfo());
            }
        }
    
    //---
    

提交回复
热议问题