Having to sink in my teeth into Java Executor Service I noticed that it falls flat for some of my requirements:
- I need to implement a small reactive system. So a Task can result in a new Task.
- The tasks schedule dynamically either as a reaction of an event (waiting for a token pool for instance) or by time.
- If a task dies I need to react accordingly so a task may be composed by different event methods or at least provide a listener service (like the Google guava lib)
I do not like the idea to implement it myself. But it is a event listener collection waiting for events to happen and immediately schedule tasks for this. Scheduling a job for a certain point in time is just also generating a timer event that is triggered by a waiting queue waiting for the nearest timer event to happen notify the framework and done.
So is there something around that provides this or a default way to use a Java Executor for this?
Use the java concurrency package which borrows concepts from a very up and coming framework called akka. That should be enough to do what you want, if not then use akka. I have an example here: Executing Dependent tasks in parallel in Java
EDIT: Yes correct in my example there was blocking on the get methods, simply use the
To remove any blocking.