Reputation: 458
I am trying cancel EJB timers in my application through the following code:
Collection <Timer>timers = timerService.getTimers();
System.out.println("logtimer: No of Active timers = "+timers.size());
if(timers != null){
for (Timer timer : timers) {
System.out.println("logtimer: About to cancel Timer "+timer.toString());
if(timer.getInfo()!=null){
timer.cancel();
System.out.println("logtimer: Cancelled Timer "+timer.getInfo());
}
}
}
However eventhough I have 3 active timers at present the timer.getInfo()
method call always returns a null. What is wrong with my code ?
Upvotes: 0
Views: 152
Reputation: 33936
Timer.getInfo() returns the value you specified when you created the timer (or if you used @Schedule
, the info is specified via that annotation). If it returns null, that means you didn't specify a value.
Upvotes: 1