[jboss-user] [EJB 3.0 Users] - Re: Client calls Timer only once
do-not-reply at jboss.com
Tue Oct 20 12:01:46 EDT 2009
Now that we know you are looking at the correct examples, let's look into the details :)
"Fuchs" wrote :
| Now, the Server-Methode should be called every fifth sec.
| In my Application it is only once called.
If you look at the bean implementation http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/docs/tutorial/timer/src/org/jboss/tutorial/timer/bean/ExampleTimerBean.java, we are calling the createTimer with 2 arguments:
ctx.getTimerService().createTimer(new Date(new Date().getTime() + milliseconds), "Hello World");
This will create a timer which is scheduled to be triggered at the specified time, only once. If you want it to repeat every x milli seconds, then you will have to use the overloaded method which accepts 3 arguments http://java.sun.com/javaee/5/docs/api/javax/ejb/TimerService.html#createTimer(java.util.Date,%20long,%20java.io.Serializable)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261313#4261313
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261313
More information about the jboss-user