my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes Setting Cron Expression in EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Setting Cron Expression in EJB" Watch "Setting Cron Expression in EJB" New topic
Author

Setting Cron Expression in EJB

balaji anatha padmanaban
Greenhorn

Joined: Jun 18, 2008
Posts: 19
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

Joined: Apr 14, 2004
Posts: 10336

Any reason why you don't just use an EJB Timer?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jair Rillo Junior
Ranch Hand

Joined: Aug 27, 2008
Posts: 114
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.


Regards, Jair Rillo Junior
http://www.jairrillo.com/blog, SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 5.0, IBM SOA Associate (Test 664).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting Cron Expression in EJB
 
Similar Threads
Quartz Scheduler that runs every x months
Schedule a task
Validating Cron Expression
Generating Cron Expression
cron expression for every 45 minutes