wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes java scheduled 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 "java scheduled job" Watch "java scheduled job" New topic
Author

java scheduled job

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
How to create a java scheduled job inside a j2ee application EAR file ? I want to bundle it in a EAR and deploy it. I heard about TimerTask, but people usually implement it as a servlet listener, which means when servlet or server is restarted the job is triggered. But I don't want that to happen, I want the job purely run at certain day/time. Can I do that ?

Is there any other way to schedule a job without being affected by server or application restart, assuming I still want to bundle it with a EAR ?

I don't like to use cronjob though, so that's not an option.

Thank you.
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Hello Ben,

Have you looked into Quartz framework? Here's a link if you are interested -> Quartz Scheduler


Shailesh Kini.
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
Originally posted by Shailesh Kini:
Hello Ben,

Have you looked into Quartz framework? Here's a link if you are interested -> Quartz Scheduler


Thanks. I heard of that but never used it before. My major concern is --

I know both "TimerTask" and "Quartz" can be scheduled task. But

1) which one can be bundled with a j2ee application, and does NOT have to be triggered automatically when the application is deployed/redeployed or server is rebooted ? i.e. I want it to run using its own scheduler without being affected by the j2ee server reboot or application redeployment.

2) In addition to run at its chedule, which one also has the flexibility to be triggered upon request ?
David Heffelfinger
author
Ranch Hand

Joined: Jul 08, 2004
Posts: 176
Alternatively, you could use the EJB timer service.

Here is an article explaining how to do this in a J2EE 1.4 server.

My book, Java EE 5 Development Using GlassFish Application Server covers how to do this with Java EE 5.

Hope that helps,
David


Author, <a href="http://www.packtpub.com/java-ee5-development-with-netbeans-6" target="_blank" rel="nofollow">Java EE 5 Development with NetBeans 6</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java scheduled job
 
Similar Threads
access one EAR from another EAR
clustered environment question
deploy web application as a standalone zip ?
URGENT HELP !!! J2EE AND EJB(J2EE CLIENT NOT RUN)
web service not available