Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a java library for scheduling dependent runnables (given in a dependency DAG)?

I have a bunch of runnables I want to run in multiple threads and some depend on others to complete before they begin. I wrote a simple utility to do this, but is there a library that already provides this capability?

like image 908
jonderry Avatar asked Aug 30 '12 18:08

jonderry


2 Answers

You can use a CountDownLatch to coordinate the activites of threads

like image 130
Cratylus Avatar answered Nov 01 '22 17:11

Cratylus


"some depend on others to complete before they begin".

I assume this means some tasks use results of other tasks as input arguments. If so, search for "java dataflow" or "java workflow".

If input arguments for each task can be represented with a single sequential queue, this special kind of dataflow is known as "Actor model", so search for "java actor library or framework".

In particular, an opensource project of mine df4j supports both dataflow and actor styles.

like image 34
Alexei Kaigorodov Avatar answered Nov 01 '22 17:11

Alexei Kaigorodov