Package VASSAL.tools.concurrent
Class QueueJoiner
java.lang.Object
VASSAL.tools.concurrent.QueueJoiner
A
Callable
which calls a Callable
retrieved from a queue.
QueueJoiner
permits one queue of Callable
s to be joined
into a single Callable
and inserted into another queue. One reason
for doing this is to make a single queue of Callable
s available
from multiple threads. E.g., if a task run by an ExecutorService
needs to submit other tasks to the same ExecutorService
, those
child tasks ey can be queued and submitted via a QueueJoiner
, while
the original task can work on the same queue using a second
QueueJoiner
. This prevents the ExecutorService
from
deadlocking in the event that the child tasks are unable to make it to the
front of the ExecutorService
's queue, because the thread of the
original task will eventually clear the queue on its own.- Since:
- 3.1.11
- Author:
- Joel Uckelman
-
Field Summary
-
Constructor Summary
ConstructorDescriptionQueueJoiner
(BlockingQueue<? extends Callable<?>> queue) Creates aCallable
which calls aCallable
retrieved from a queue. -
Method Summary
-
Field Details
-
queue
-
-
Constructor Details
-
QueueJoiner
Creates aCallable
which calls aCallable
retrieved from a queue.- Parameters:
queue
- the queue
-
-
Method Details
-
call
-