Package org.apache.xmlrpc.common
Class XmlRpcWorkerFactory
- java.lang.Object
-
- org.apache.xmlrpc.common.XmlRpcWorkerFactory
-
- Direct Known Subclasses:
XmlRpcClientWorkerFactory,XmlRpcServerWorkerFactory
public abstract class XmlRpcWorkerFactory extends java.lang.ObjectA factory forXmlRpcWorkerinstances.
-
-
Field Summary
Fields Modifier and Type Field Description private XmlRpcControllercontrollerprivate intnumThreadsprivate java.util.Listpoolprivate XmlRpcWorkersingleton
-
Constructor Summary
Constructors Constructor Description XmlRpcWorkerFactory(XmlRpcController pController)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description XmlRpcControllergetController()Returns the factory controller.intgetCurrentRequests()Returns the number of currently running requests.XmlRpcWorkergetWorker()Returns a worker for synchronous processing.protected abstract XmlRpcWorkernewWorker()Creates a new worker instance.voidreleaseWorker(XmlRpcWorker pWorker)Called, when the worker did its job.
-
-
-
Field Detail
-
singleton
private final XmlRpcWorker singleton
-
controller
private final XmlRpcController controller
-
pool
private final java.util.List pool
-
numThreads
private int numThreads
-
-
Constructor Detail
-
XmlRpcWorkerFactory
public XmlRpcWorkerFactory(XmlRpcController pController)
Creates a new instance.- Parameters:
pController- The client controlling the factory.
-
-
Method Detail
-
newWorker
protected abstract XmlRpcWorker newWorker()
Creates a new worker instance.- Returns:
- New instance of
XmlRpcWorker.
-
getController
public XmlRpcController getController()
Returns the factory controller.- Returns:
- The controller, an instance of
XmlRpcClient, orXmlRpcServer.
-
getWorker
public XmlRpcWorker getWorker() throws XmlRpcLoadException
Returns a worker for synchronous processing.- Returns:
- An instance of
XmlRpcWorker, which is ready for use. - Throws:
XmlRpcLoadException- The clients maximum number of concurrent threads is exceeded.
-
releaseWorker
public void releaseWorker(XmlRpcWorker pWorker)
Called, when the worker did its job. Frees resources and decrements the number of concurrent requests.- Parameters:
pWorker- The worker being released.
-
getCurrentRequests
public int getCurrentRequests()
Returns the number of currently running requests.- Returns:
- Current number of concurrent requests.
-
-