Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a sophisticated Java WorkQueue API?

I am looking for a WorkQueue API offering the following features:

  • java.util.Queue compatible
  • offers (optional) Set-semantic
  • single- and batch-processing
  • concurrency (of course)
  • scheduling
  • different processing policies
    • wait until next scheduled execution
    • pre-process, if batch size met
    • delayed processing (minimum time in queue, before being processed)
  • persistence (optional)

There are a lot of interesting implementations in the jdk, e.g. java.util.DelayQueue which i could use. I just wanted to make sure i am not reinventing the wheel.

like image 617
whiskeysierra Avatar asked Aug 16 '10 08:08

whiskeysierra


3 Answers

Have a look at Quartz Job Scheduler API

Quartz Features : http://www.quartz-scheduler.org/overview/features.html

I am not sure about its java.util.Queue compatibility. But it provides most of features related to Job scheduling and execution.

like image 191
YoK Avatar answered Nov 11 '22 10:11

YoK


Are you still looking for an answer to accept?

I think your needs would best be met using java.util.concurrent's executor framework. See the API (here's a good start). There's an excellent support community, you can find it at the concurrency-interest web site. If you're into dead trees, Java Concurrency in Practice (JCiP) provides an excellent resource.

The executor framework allows you to create tasks (in the form of Runnables or Callables), provides several schemes for synchronizing or otherwise ordering tasks with respect to one another.

Finally, the emerging ForkJoin (FJ) infrastructure is quite usable and may match your needs. API is here, a good paper is here, and an introductory article here.

Hope this helps.

JA

like image 30
andersoj Avatar answered Nov 11 '22 12:11

andersoj


Short and straight answer - no. You have to roll out your own or you are just going to serve as a free tester for someone else's experiments. So at least you'll spend time making a system exactly for your needs, knowing all core parts and being in full control instead of taking in big and unknown dependency.

like image 1
ZXX Avatar answered Nov 11 '22 11:11

ZXX