Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.hivemind.impl.servicemodel
Class PooledServiceModel  view PooledServiceModel download PooledServiceModel.java

java.lang.Object
  extended byorg.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
      extended byorg.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.


Nested Class Summary
private  class PooledServiceModel.PooledService
           
 
Field Summary
private  java.lang.ThreadLocal _activeService
           
private  org.apache.hivemind.service.ThreadEventNotifier _notifier
           
private  java.lang.Class _serviceInterface
           
private  java.util.List _servicePool
           
private  java.lang.Object _serviceProxy
           
private static org.apache.hivemind.PoolManageable NULL_MANAGEABLE
          Shared, null implementation of PoolManageable.
protected static java.lang.String SERVICE_ACCESSOR_METHOD_NAME
          Name of a method in the deferred proxy that is used to obtain the constructed service.
 
Fields inherited from class org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
_log
 
Constructor Summary
PooledServiceModel(org.apache.hivemind.impl.ConstructableServicePoint servicePoint)
           
 
Method Summary
private  PooledServiceModel.PooledService constructPooledService()
           
private  java.lang.Object constructServiceProxy()
          Constructs the service proxy and returns it, wrapped in any interceptors.
 java.lang.Object getService()
          Invoked by the service extension point to obtain the service implementation.
private  PooledServiceModel.PooledService getServiceFromPool()
           
 java.lang.Object getServiceImplementationForCurrentThread()
           
 void instantiateService()
          Invokes getServiceImplementationForCurrentThread() 55 to instantiate an instance of the service.
private  PooledServiceModel.PooledService obtainPooledService()
           
private  void returnServiceToPool(PooledServiceModel.PooledService pooled)
           
private  void unbindPooledServiceFromCurrentThread(PooledServiceModel.PooledService pooled)
           
 
Methods inherited from class org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
addInterceptors, constructBridgeProxy, constructCoreServiceImplementation, constructNewServiceImplementation, constructServiceImplementation, getServicePoint, getShutdownCoordinatorService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

Constructor Detail

PooledServiceModel

public PooledServiceModel(org.apache.hivemind.impl.ConstructableServicePoint servicePoint)
Method Detail

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.