protected void doStart() throws Exception { if (_maxThreads<_minThreads || _minThreads<=0) throw new IllegalArgumentException("!0<minThreads<maxThreads"); _threads=new HashSet(); _idle=new ArrayList(); _queue=new LinkedList(); for (int i=0;i<_minThreads;i++) { newThread(null); } }
/** Set the minimum number of threads. * Delegated to the named or anonymous Pool. * @see #getMinThreads * @param minThreads minimum number of threads */ public void setMinThreads(int minThreads) { if (isStarted() && (minThreads<=0 || minThreads>_maxThreads)) throw new IllegalArgumentException("!0<=minThreads<maxThreads"); _minThreads=minThreads; synchronized (_lock) { while (isStarted() && _threads.size()<_minThreads) { newThread(null); } } }