/// <summary> /// Creates an ExecutorCompletionService using the supplied /// executor for base task execution and the supplied queue as its /// completion queue. /// </summary> /// <param name="executor"> the executor to use </param> /// <param name="completionQueue"> the queue to use as the completion queue /// normally one dedicated for use by this service. This /// queue is treated as unbounded -- failed attempted /// {@code Queue.add} operations for completed tasks cause /// them not to be retrievable. </param> /// <exception cref="NullPointerException"> if executor or completionQueue are {@code null} </exception> public ExecutorCompletionService(Executor executor, BlockingQueue <Future <V> > completionQueue) { if (executor == null || completionQueue == null) { throw new NullPointerException(); } this.Executor = executor; this.Aes = (executor is AbstractExecutorService) ? (AbstractExecutorService)executor : null; this.CompletionQueue = completionQueue; }