Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.ioc.internal.services
Class PerThreadServiceLifecycle

    java.lang.Object
      org.apache.tapestry5.ioc.internal.services.PerThreadServiceLifecycle

All Implemented Interfaces:
  ServiceLifecycle

    public class PerThreadServiceLifecycle

extends java.lang.Object
implements ServiceLifecycle

Allows a service to exist "per thread" (in each thread). Creates a proxy that delegates to a per-thread instance.

This scheme ensures that, although the service builder method will be invoked many times over the life of the application, the service decoration process occurs only once. The final calling chain is: Service Proxy --> Interceptor(s) (from Decorators) --> Advise Proxy (from Advisiors) --> PerThread Proxy --> (per thread) instance.

Constructor Summary
`PerThreadServiceLifecycle(PerthreadManager perthreadManager, PlasticProxyFactory proxyFactory)`

Method Summary
`java.lang.Object` | `createService(ServiceResources resources, ObjectCreator creator)` Returns the same creator, or a new one, that encapsulates the creation of the core service implementation.
`boolean` | `isSingleton()` Returns false; this lifecycle represents a service that will be created many times (by each thread).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PerThreadServiceLifecycle

    public PerThreadServiceLifecycle(@Builtin
                                     PerthreadManager perthreadManager,
                                     @Builtin
                                     PlasticProxyFactory proxyFactory)

Method Detail

### isSingleton

    public boolean isSingleton()

  Returns false; this lifecycle represents a service that will be created many times (by each thread).

  Specified by:
    `isSingleton` in interface `ServiceLifecycle`
  Returns:
    true for singletons, false for services that can be repeatedly constructed

### createService

    public java.lang.Object createService(ServiceResources resources,
                                          ObjectCreator creator)

  Description copied from interface: `ServiceLifecycle`
  Returns the same creator, or a new one, that encapsulates the creation of the core service implementation.

  Specified by:
    `createService` in interface `ServiceLifecycle`
  Parameters:
    `resources` - source of information about the service to be created, and source of additional services or other resources that may be needed when constructing the core service implementation
    `creator` - object capable of creating the service implementation on demand. This is a wrapper around the service's builder method.
  Returns:
    the service or equivalent service proxy

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.