Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz vs Java EE 7 scheduler


I'm a java EE developer which has used until now frameworks like Quartz to schedule tasks. I can see that Java EE 7 features a ManagedScheduledExecutorService to schedule single or repeating tasks. As I have never used in real projects this new features I wonder if there are still advantages of using Quartz (or others) when you have a portable way to do it ?
Thanks!

like image 378
user2824073 Avatar asked Feb 06 '14 09:02

user2824073


People also ask

Why should we use Quartz scheduler?

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.

How many jobs can Quartz handle?

The actual number of jobs that can be running at any moment in time is limited by the size of the thread pool. If there are five threads in the pool, no more than five jobs can run at a time.

What is Quartz software?

Quartz is a job scheduling library that can be integrated into a wide variety of Java applications. Quartz is generally used for enterprise class applications to support process workflow, system management (maintenance) actions and to provide timely services within the applications. Quartz also supports clustering.

What is Quartz misfire?

A misfire occurs if a persistent trigger “misses” its firing time because of the scheduler being shutdown, or because there are no available threads in Quartz's thread pool for executing the job. The different trigger types have different misfire instructions available to them.


1 Answers

I believe that in future projects, there's really no need to use third-party libraries. Java EE 7 is full of scheduling features. Besides the new ManagedScheduledExecutorService, there's already the Schedule annotation for single and periodic repeating tasks and the Timeout annotation to create timers programmatically. IMO the new managed scheduled service is better suited for single delayed tasks or to create a job chain with delays betweens specific tasks.

You can find more about Java EE Timer Service (Schedule and Timeout) Java EE 6 or Java EE 7.

On a side note, if you ever try clustering your application, it's relatively easy to setup Schedule-like timers to run globally, instead of once per node - which is another plus.

like image 111
andrepnh Avatar answered Sep 19 '22 13:09

andrepnh