Interface RequestProcessorFactoryFactory
-
- All Known Implementing Classes:
RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory
,RequestProcessorFactoryFactory.StatelessProcessorFactoryFactory
public interface RequestProcessorFactoryFactory
The request processor is the object, which is actually performing the request. There is nothing magic about the request processor: It may very well be a POJO. The
RequestProcessorFactoryFactory
is passed to theAbstractReflectiveHandlerMapping
at startup. The mapping uses this factory to create instances ofRequestProcessorFactoryFactory.RequestProcessorFactory
, which are used to initialize theReflectiveXmlRpcHandler
. The handler in turn uses its factory to create the actual request processor when a request comes in.However, the question arises, when and how the request processor is created and whether it needs request specific initialization. The
RequestProcessorFactoryFactory
is an object, which makes that logic pluggable. Unfortunately, we aren't done with a single factory: We even need a factory for factories. The rationale is best explained by looking at the different use cases and how to implement them.The default
RequestProcessorFactoryFactory
is theRequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory
. It creates a new processor instance for any request. In other words, it allows the request processor to have some state. This is fine, if the request processor is a lightweight object or needs request specific initialization. In this case, the actual request processor is created and invoked when callingRequestProcessorFactoryFactory.RequestProcessorFactory.getRequestProcessor(XmlRpcRequest)
.An alternative implementation is the
RequestProcessorFactoryFactory.StatelessProcessorFactoryFactory
, which may be used to create stateless request processors. Stateless request processors are typically heavyweight objects, which have an expensive initialization phase. The processor factory, which is created bygetRequestProcessorFactory(Class pClass)
contains an initialized singleton, which is returned byRequestProcessorFactoryFactory.RequestProcessorFactory.getRequestProcessor(XmlRpcRequest)
.Other alternatives might be a
RequestProcessorFactoryFactory
, which maintains a pool ofRequestProcessorFactoryFactory.RequestProcessorFactory
instances. The instances are configured by callingRequestProcessorFactoryFactory.RequestProcessorFactory.getRequestProcessor(XmlRpcRequest)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RequestProcessorFactoryFactory.RequestProcessorFactory
This is the factory for request processors.static class
RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory
This is the default implementation ofRequestProcessorFactoryFactory
.static class
RequestProcessorFactoryFactory.StatelessProcessorFactoryFactory
This is an alternative implementation ofRequestProcessorFactoryFactory
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RequestProcessorFactoryFactory.RequestProcessorFactory
getRequestProcessorFactory(java.lang.Class pClass)
This method is invoked at startup.
-
-
-
Method Detail
-
getRequestProcessorFactory
RequestProcessorFactoryFactory.RequestProcessorFactory getRequestProcessorFactory(java.lang.Class pClass) throws XmlRpcException
This method is invoked at startup. It creates a factory for instances ofpClass
.- Throws:
XmlRpcException
-
-