@Test public void buildQueue1() throws Exception { BlockingQueue<Runnable> queue = ThreadPoolUtils.buildQueue(0, true); Assert.assertEquals(queue.getClass(), SynchronousQueue.class); queue = ThreadPoolUtils.buildQueue(-1, true); Assert.assertEquals(queue.getClass(), PriorityBlockingQueue.class); queue = ThreadPoolUtils.buildQueue(100, true); Assert.assertEquals(queue.getClass(), PriorityBlockingQueue.class); queue = ThreadPoolUtils.buildQueue(-1, false); Assert.assertEquals(queue.getClass(), LinkedBlockingQueue.class); queue = ThreadPoolUtils.buildQueue(100, false); Assert.assertEquals(queue.getClass(), LinkedBlockingQueue.class); }
public static BlockingQueue<Runnable> buildQueue(int size) { return buildQueue(size, false); }
ThreadPoolUtils { public static BlockingQueue<Runnable> buildQueue(int size) { return buildQueue(size, false); } }
ThreadPoolUtils { public static BlockingQueue<Runnable> buildQueue(int size) { return buildQueue(size, false); }  }
ThreadPoolUtils { public static BlockingQueue<Runnable> buildQueue(int size) { return buildQueue(size, false); }  static ThreadPoolExecutor newFixedThreadPool(int corePoolSize); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue,
                                                        ThreadFactory threadFactory); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue,
                                                        ThreadFactory threadFactory,
                                                        RejectedExecutionHandler handler); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory,
                                                         RejectedExecutionHandler handler); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         int keepAliveTime,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory,
                                                         RejectedExecutionHandler handler); static BlockingQueue<Runnable> buildQueue(int size); static BlockingQueue<Runnable> buildQueue(int size, boolean isPriority); }
ThreadPoolUtils { public static BlockingQueue<Runnable> buildQueue(int size) { return buildQueue(size, false); }  static ThreadPoolExecutor newFixedThreadPool(int corePoolSize); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue,
                                                        ThreadFactory threadFactory); static ThreadPoolExecutor newFixedThreadPool(int corePoolSize,
                                                        BlockingQueue<Runnable> queue,
                                                        ThreadFactory threadFactory,
                                                        RejectedExecutionHandler handler); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory,
                                                         RejectedExecutionHandler handler); static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         int keepAliveTime,
                                                         BlockingQueue<Runnable> queue,
                                                         ThreadFactory threadFactory,
                                                         RejectedExecutionHandler handler); static BlockingQueue<Runnable> buildQueue(int size); static BlockingQueue<Runnable> buildQueue(int size, boolean isPriority); static int THREAD_PRIORITY_NORMAL; static int THREAD_PRIORITY_HIGH; static int THREAD_PRIORITY_LOW; }