public QueuedThreadPool(@Name("maxThreads") int maxThreads, @Name("minThreads") int minThreads, @Name("idleTimeout") int idleTimeout, @Name("reservedThreads") int reservedThreads, @Name("queue") BlockingQueue<Runnable> queue, @Name("threadGroup") ThreadGroup threadGroup) { if (maxThreads < minThreads) { throw new IllegalArgumentException("max threads ("+maxThreads+") less than min threads (" +minThreads+")"); } setMinThreads(minThreads); setMaxThreads(maxThreads); setIdleTimeout(idleTimeout); setStopTimeout(5000); setReservedThreads(reservedThreads); if (queue==null) { int capacity=Math.max(_minThreads, 8); queue=new BlockingArrayQueue<>(capacity, capacity); } _jobs=queue; _threadGroup=threadGroup; setThreadPoolBudget(new ThreadPoolBudget(this)); }
public QueuedThreadPool(@Name("maxThreads") int maxThreads, @Name("minThreads") int minThreads, @Name("idleTimeout") int idleTimeout, @Name("reservedThreads") int reservedThreads, @Name("queue") BlockingQueue<Runnable> queue, @Name("threadGroup") ThreadGroup threadGroup) { if (maxThreads < minThreads) { throw new IllegalArgumentException("max threads ("+maxThreads+") less than min threads (" +minThreads+")"); } setMinThreads(minThreads); setMaxThreads(maxThreads); setIdleTimeout(idleTimeout); setStopTimeout(5000); setReservedThreads(reservedThreads); if (queue==null) { int capacity=Math.max(_minThreads, 8); queue=new BlockingArrayQueue<>(capacity, capacity); } _jobs=queue; _threadGroup=threadGroup; setThreadPoolBudget(new ThreadPoolBudget(this)); }