How to stop endless EJB 3 timer ?

Posted by worldpython on Stack Overflow See other posts from Stack Overflow or by worldpython
Published on 2010-01-21T19:27:24Z Indexed on 2010/04/22 10:33 UTC
Read the original article Hit count: 314

Filed under:
|
|
|
|

Hi, I am new to EJB 3 . I use the following code to start endless EJB 3 timer then deploying it on JBOSS 4.2.3

@Stateless
public class SimpleBean  implements SimpleBeanRemote,TimerService  {

@Resource
TimerService timerService;
private Timer timer ;
@Timeout
public void timeout(Timer timer) {
    System.out.println("Hello EJB");

 }
}

then calling it

  timer = timerService.createTimer(10,  5000, null);

It works well. I created a client class that calls a method that creates the timer and a method that is called when the timer times out.

I forget to call cancel then it does not stop .redeploy with cancel call never stop it. restart Jboss 4.2.3 never stop it. How I can stop EJB timer ? Thanks for helping.

© Stack Overflow or respective owner

Related posts about java

Related posts about ejb3