Class QueueJoiner

java.lang.Object
VASSAL.tools.concurrent.QueueJoiner
All Implemented Interfaces:
Callable<Void>

public class QueueJoiner extends Object implements Callable<Void>
A Callable which calls a Callable retrieved from a queue. QueueJoiner permits one queue of Callables to be joined into a single Callable and inserted into another queue. One reason for doing this is to make a single queue of Callables 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 Details

  • Constructor Details

    • QueueJoiner

      public QueueJoiner(BlockingQueue<? extends Callable<?>> queue)
      Creates a Callable which calls a Callable retrieved from a queue.
      Parameters:
      queue - the queue
  • Method Details