Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching for Generic Asynchronous Java Job Execution Framework / Library

I am looking for a generic asynchronous Java job execution framework that could handle Callables or Runnables. It would be similar to java.util.concurrent.ExecutorService, (and possibly wrap ExecutorService), but it would also have the following features:

  1. The ability to persist jobs to a database in case the application goes down while a job is being serviced, and be able to restart the unfinished jobs. (I understand that my job may have to implement Serializable which is OK.)

  2. Work with UUIDs to enable the client to obtain job tokens and inquire about job status. (Under the hood this information would be persisted to a database, as well.)

I have started working on this myself by building around ExecutorService, but I would prefer an out of the box, open source solution, if one exists.

Something that could work within the Spring Framework would be ideal.

like image 482
Julien Chastang Avatar asked Mar 04 '09 22:03

Julien Chastang


2 Answers

You may want to look at Quartz.

Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components or EJBs. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.

like image 84
Apocalisp Avatar answered Oct 04 '22 03:10

Apocalisp


You can use Quartz, and create a concrete Job adapter that delegates to a Runnable or Callable. Quartz' Job interface adds the ability to maintain some state between invocations of a task. If desired, Quartz can store jobs and their state durably in a relational database, and execute them on a scalable cluster of hosts.

like image 26
erickson Avatar answered Oct 04 '22 01:10

erickson