0
我想與Weblogic上11G計時器啓動EJB 3.0,但我不能用PostConstruct開始用計時器的EJB應用程序時開始
我能做些什麼來啓動這個EJB在應用程序啓動?
@Resource TimerService timerService;
@PostConstruct
public void initialize() {
}
@Timeout
public void timeout(Timer timer)
{
System.out.println("Timeout occurred !!!");
if (timerService.getTimers().size() <= 1) {
Timer newtimer = timerService.createTimer(5000,"Clean Timer");
}
}
@Override
public void inicia() {
if (timerService.getTimers().size() == 0) {
Timer timer = timerService.createTimer(5000,"Clean Timer");
}
}
也許在另一個PostConstruct中的EJB我可以調用它嗎?
在'ServletContextListener'? – Kayaman