Here you can find the source of createQueue(final int queueCapacity)
Parameter | Description |
---|---|
queueCapacity | the specified queue capacity |
private static BlockingQueue<Runnable> createQueue(final int queueCapacity)
//package com.java2s; //License from project: Apache License import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; public class Main { /**/*from w w w .j a va 2 s . c o m*/ * Create the BlockingQueue to use for the ThreadPoolExecutor. * <p> * A LinkedBlockingQueue instance will be created for a positive capacity * value; a SynchronousQueue else. * * @param queueCapacity * the specified queue capacity * @return the BlockingQueue instance * @see java.util.concurrent.LinkedBlockingQueue * @see java.util.concurrent.SynchronousQueue */ private static BlockingQueue<Runnable> createQueue(final int queueCapacity) { if (queueCapacity > 0) { return new LinkedBlockingQueue<Runnable>(queueCapacity); } return new SynchronousQueue<Runnable>(); } }