For a system monitoring Java application which currently runs on the command line and uses ScheduledExecutorService
, I would like to write a simple web application version, to be run in a Servlet container like Apache Tomcat or Eclipse Jetty.
I have read about Quartz as one of the popular job schedulers for web applications. Would it be better (maybe because of better servlet container integration) to port this application from ScheduledExecutorService
to Quartz?
Adding another library dependency to the application is not a problem, I am interested in technical reasons against usage of ScheduledExecutorService
.
public interface ScheduledExecutorService extends ExecutorService. An ExecutorService that can schedule commands to run after a given delay, or to execute periodically. The schedule methods create tasks with various delays and return a task object that can be used to cancel or check execution.
27.6 Using the Quartz Scheduler For convenience purposes, Spring offers a couple of classes that simplify the usage of Quartz within Spring-based applications.
Quartz scheduler allows an enterprise to schedule a job at a specified date and time. It allows us to perform the operations to schedule or unschedule the jobs. It provides operations to start or stop or pause the scheduler. It also provides reminder services.
It depends on what you are using it for.
Quartz is useful for programmed times e.g. every hour on the hour.
ScheduledExecutorService is useful for repeating tasks which don't have to occur at a specific time. Its simpler and possibly more efficient. If you have this working it indicates to me that you don't need Quartz.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With