I am new to J2EE and i am working on couple of tasks. one of them is : I have a web application that works like a reporting toolbox hosted by Apache tomcat 7, I need a heavy weight job to be scheduled to run every hour or other intervals, I googled and find Apache Sling that is kind of separate application server for content-centeric applications. I want to know if there is other solution could be done Apache tomcat or not ? also its important that solution would be standard and reliable.
Asked
Active
Viewed 3,019 times
0
-
What is the scheduled task doing? – Stefan Oct 19 '15 at 13:05
-
@Stefan it runs multiple queries on an oracle database and process on that resultset, process maybe run over 200K rows each time – DjBuddy Oct 19 '15 at 18:05
3 Answers
1
There's the ScheduledExecutorService which is part of the standard java api. See the new*Schedule*
factory methods in Executors.
For a more heavyweight / configurable option there's Quartz. One of Quartz' nice features is it's support for cron expressions

lance-java
- 25,497
- 4
- 59
- 101
-
thanks for your response, does the Quartz gets integrated with tomcat ? – DjBuddy Oct 19 '15 at 14:58
-
I'm not sure if quartz comes bundeled with a [ServletContextListener](https://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html) or not. If it doesn't you'll need to create one and include it in your `web.xml` – lance-java Oct 19 '15 at 15:34
1
You can also use Spring Batch. Here's a link that can help you understand this framework.

Dale
- 1,613
- 4
- 22
- 42
0
In case none of the packages work for you one option would be to implement a ServletContextListener. It is an object that is launched when your site goes online. The only problem is that you have to manage all the scheduling.

Amer Agovic
- 380
- 2
- 6