0

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.

DjBuddy
  • 171
  • 1
  • 4
  • 14

3 Answers3

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.

http://projects.spring.io/spring-batch/faq.html

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