java.lang.Object
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
org.apache.hivemind.impl.servicemodel.PooledServiceModel
- All Implemented Interfaces:
- org.apache.hivemind.internal.ServiceModel
- public class PooledServiceModel
- extends AbstractServiceModelImpl
Similar to the
threaded service model,
except that, once created, services are pooled for later use.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SERVICE_ACCESSOR_METHOD_NAME
protected static final java.lang.String SERVICE_ACCESSOR_METHOD_NAME
- Name of a method in the deferred proxy that is used to obtain the constructed service.
- See Also:
- Constant Field Values
_serviceProxy
private java.lang.Object _serviceProxy
_notifier
private org.apache.hivemind.service.ThreadEventNotifier _notifier
_activeService
private java.lang.ThreadLocal _activeService
_servicePool
private java.util.List _servicePool
_serviceInterface
private java.lang.Class _serviceInterface
- Since:
- 1.1
NULL_MANAGEABLE
private static final org.apache.hivemind.PoolManageable NULL_MANAGEABLE
- Shared, null implementation of PoolManageable.
PooledServiceModel
public PooledServiceModel(org.apache.hivemind.impl.ConstructableServicePoint servicePoint)
getService
public java.lang.Object getService()
- Description copied from interface:
org.apache.hivemind.internal.ServiceModel
- Invoked by the service extension point to obtain the service implementation. The model may
return the actual service implementation or some form of proxy.
This method is only invoked once; the returned value is used from that point on
(in all threads, by all callers). Most models return a proxy that takes care of realizing the
service (actually creating the service, configuring it, and wrapping it with interceptors)
only when needed.
constructServiceProxy
private java.lang.Object constructServiceProxy()
- Constructs the service proxy and returns it, wrapped in any interceptors.
getServiceImplementationForCurrentThread
public java.lang.Object getServiceImplementationForCurrentThread()
obtainPooledService
private PooledServiceModel.PooledService obtainPooledService()
getServiceFromPool
private PooledServiceModel.PooledService getServiceFromPool()
returnServiceToPool
private void returnServiceToPool(PooledServiceModel.PooledService pooled)
constructPooledService
private PooledServiceModel.PooledService constructPooledService()
unbindPooledServiceFromCurrentThread
private void unbindPooledServiceFromCurrentThread(PooledServiceModel.PooledService pooled)
instantiateService
public void instantiateService()
- Invokes
getServiceImplementationForCurrentThread() 55 to instantiate an instance of the
service.