• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Cron Expression in EJB

 
balaji anatha padmanaban
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I need to set the cron expression to run a method present in a Stateless bean for every 5 min.
Before i used servlet form there I called.
Now I need to do without using the servlet only ejb is there .There is no front end.It s a seperate process.
So, can you please help me in how to set the cron expression and it should start when the ejb.jar is installed.
Where I need to add the code

Thanks
A.Baljai.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any reason why you don't just use an EJB Timer?
 
Jair Rillo Junior
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Paul. EJB Timer Service is really great for that.

I have been using EJB Timer Service since EJB2 and it works fine (in EJB3 it's much easier).

You can set a duration, initial date and interval. Also, even the server crash, the EJB Timer keeps registered. When the server backs, the EJB Timer back automatically, very useful.

Just pay attention if you have more than one Timers Service. In this case, the order is not guaranteed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic