/** * Create (or allocate) and return an available processor for use in * processing a specific HTTP request, if possible. If the maximum * allowed processors have already been created and are in use, return * <code>null</code> instead. */ private MasterSlaveWorkerThread createWorkerThread() { synchronized (workerThreads) { if (workerThreads.size() > 0) { return ((MasterSlaveWorkerThread) workerThreads.pop()); } if ((maxThreads > 0) && (curThreads < maxThreads)) { return (newWorkerThread()); } else { if (maxThreads < 0) { return (newWorkerThread()); } else { return (null); } } } }