/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }