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

Quick Search    Search Deep

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

java.lang.Object
  extended byorg.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
      extended byorg.apache.hivemind.impl.servicemodel.ThreadedServiceModel
All Implemented Interfaces:
org.apache.hivemind.internal.ServiceModel

public final class ThreadedServiceModel
extends AbstractServiceModelImpl

Like SingletonServiceModel, this method returns a proxy (implementing the service interface); unlike SingletonServiceModel, it always returns the proxy. Invoking a service method on the proxy constructs a service implementation and binds it to the current thread.


Nested Class Summary
(package private)  class ThreadedServiceModel.CleanupListener
           
 
Field Summary
private  java.lang.ThreadLocal _activeService
          Used to store the active service for the current thread.
private  org.apache.hivemind.service.ThreadEventNotifier _notifier
           
private  java.lang.Class _serviceInterface
           
private  java.lang.Object _serviceProxy
           
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
ThreadedServiceModel(org.apache.hivemind.impl.ConstructableServicePoint servicePoint)
           
 
Method Summary
private  java.lang.Object constructServiceForCurrentThread()
           
private  java.lang.Object createServiceProxy()
          Creates a proxy instance for the service, and returns it, wrapped in any interceptors for the service.
 java.lang.Object getService()
          Always returns the service proxy.
 java.lang.Object getServiceImplementationForCurrentThread()
          Invoked by the proxy to return the active service impl for this thread, constructing it as necessary.
 void instantiateService()
          Invokes getServiceImplementationForCurrentThread() 55 to force the creation of the service implementation.
private  void unbindServiceFromCurrentThread()
           
 
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

_serviceInterface

private java.lang.Class _serviceInterface
Since:
1.1

_activeService

private java.lang.ThreadLocal _activeService
Used to store the active service for the current thread.

Constructor Detail

ThreadedServiceModel

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

getService

public java.lang.Object getService()
Always returns the service proxy.


createServiceProxy

private java.lang.Object createServiceProxy()
Creates a proxy instance for the service, and returns it, wrapped in any interceptors for the service.


getServiceImplementationForCurrentThread

public java.lang.Object getServiceImplementationForCurrentThread()
Invoked by the proxy to return the active service impl for this thread, constructing it as necessary.


constructServiceForCurrentThread

private java.lang.Object constructServiceForCurrentThread()

unbindServiceFromCurrentThread

private void unbindServiceFromCurrentThread()

instantiateService

public void instantiateService()
Invokes getServiceImplementationForCurrentThread() 55 to force the creation of the service implementation.