File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Cron Job Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Cron Job" Watch "Cron Job" New topic

Cron Job

Hisouka Devera
Ranch Hand

Joined: Oct 16, 2012
Posts: 30
Good Day Experts,

We have EJB JSF application. I need to create a scheduler like a cron job, where the application will generate a report based on what customer defined(saved in database). For example, customer define to generate a report every 3pm. Or a customer can define to generate a report for them every Friday 7am.

Any idea on How can I implent this? given that we use EJB JSF running in JBOSS 7.

Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1101

There are several options to do this. The simplest option will be to write a standalone java program that keeps running 24/7. This will check and if time matches will generate the report.
You can also use schedulers like Quartz to do this.

You can use EJB timers too, but that will be complex and probably overkill for this...

balajik Kumar

Joined: Aug 18, 2012
Posts: 4
If you want to use EJB timers you need to have your application running(EJB requires a container available in App server). The other option would be(In case if you dont have any EJB calls in between)
1) you could use Quartz as Ranganathan mentioned in the post.
2)Have a standalone file using JDK timers which will triggers at a particular time
3)In case of unix machine, configure a cronjob calling a shell script file and this file would have the java call (java FetchReport).

I agree. Here's the link:
subject: Cron Job
jQuery in Action, 3rd edition