/** * Creates a {@link BlockingQueue} which does not allow for non-blocking addition to the queue. * This is useful with {@link #waitInQueueExecutionHandler()} to turn force a * {@link ThreadPoolExecutor} to create as many threads as it is configured to before starting * to fill the queue. * * @param delegate Backing blocking queue. * @return A new blocking queue backed by the delegate */ public static <E> BlockingQueue<E> offerFailingBlockingQueue(final BlockingQueue<E> delegate) { return new ForwardingBlockingQueue<E>() { @Override @SuppressWarnings("checkstyle:parameterName") public boolean offer(@Nonnull final E o) { return false; } @Override protected BlockingQueue<E> delegate() { return delegate; } }; }