org.apache.hivemind.impl.servicemodel
Class SingletonServiceModel

java.lang.Object
  extended by org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
      extended by org.apache.hivemind.impl.servicemodel.SingletonServiceModel
All Implemented Interfaces:
ServiceModel

public final class SingletonServiceModel
extends AbstractServiceModelImpl

Subclass of AbstractServiceModelImpl which supports creation of a singleton service proxy (deferring the actual construction of the service until absolutely necessary). This is used with the singleton service type, which is the default.

Author:
Howard Lewis Ship

Field Summary
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
SingletonServiceModel(ConstructableServicePoint servicePoint)
           
 
Method Summary
 java.lang.Object getActualServiceImplementation()
          This is invoked by the proxy to create the actual implementation.
 java.lang.Object getService()
          Invoked by the service extension point to obtain the service implementation.
 void instantiateService()
          Forces the core service implementation (and any interceptors) to be fully instantiated immediately, rather than waiting for the first service method invocation.
 
Methods inherited from class org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl
addInterceptors, constructBridgeProxy, constructCoreServiceImplementation, constructNewServiceImplementation, constructServiceImplementation, getServicePoint, registerWithShutdownCoordinator
 
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
Constructor Detail

SingletonServiceModel

public SingletonServiceModel(ConstructableServicePoint servicePoint)
Method Detail

getService

public java.lang.Object getService()
Description copied from interface: 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.


getActualServiceImplementation

public java.lang.Object getActualServiceImplementation()
This is invoked by the proxy to create the actual implementation.


instantiateService

public void instantiateService()
Description copied from interface: ServiceModel
Forces the core service implementation (and any interceptors) to be fully instantiated immediately, rather than waiting for the first service method invocation. This is used when a service needs to be "eagerly loaded" rather than "lazy loaded".