Interface ServiceLifecycle

All Known Subinterfaces:
ServiceLifecycle2
All Known Implementing Classes:
PerThreadServiceLifecycle, SingletonServiceLifecycle

public interface ServiceLifecycle
Allows certain types of lifecycles to control exactly how services are instantiated.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the same creator, or a new one, that encapsulates the creation of the core service implementation.
    boolean
    Returns true if the lifecycle is a singleton (a service that will only be created once).
  • Method Details

    • createService

      Returns the same creator, or a new one, that encapsulates the creation of the core service implementation.
      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
    • isSingleton

      boolean isSingleton()
      Returns true if the lifecycle is a singleton (a service that will only be created once). Return false if the underlying service instance may be created multiple times (for example, the ScopeConstants.PERTHREAD scope}. A future version of Tapestry IoC may optimize for the later case.
      Returns:
      true for singletons, false for services that can be repeatedly constructed