OlliP
OlliP

Reputation: 1585

Looking for no-cron based Java Scheduler

I'm looking for a Java scheduling framework which is not timer-driven or any kind of cron-style scheduler like Quartz and others. There are awfully many questions and answers here that address timer-driven schedulers, but such a scheduler wouldn't solve my problem.

The problem I have is that I have several threads where each takes messages from a blocking queue assigned to it. When a blocking queue is empty the thread that reads from it is blocked and cannot be assigned to some other thread. This way my system can run into some starvation problem. Because of this JDK5 thread pools won't fit in as they can only assign idle threads that are not blocked to another queue that needs to be served.

I found hawt dispatch on the Internet which is very much what I need, but its advanced features like futures, that would make things much more comfortable for me, are only available when using the Scala API. Anybody knows some Java framework similar to hawt dispatch? Any hint much appreaciated.

Regards, Oliver

Upvotes: 0

Views: 246

Answers (1)

npe
npe

Reputation: 15699

To be honest, I do not know of any framework doing what you described, but I'd rather change the implementation of threads to not block on the queues.

Even if the queues implement the BlockingQueue interface, they still can be examined in non-blocking manner using Queue#peek() method.

Upvotes: 1

Related Questions