Interface Activator<T>

Type Parameters:
T - type of the instance

public interface Activator<T>
Activator is responsible for lifecycle management of a service instance within a scope.
  • Method Details

    • descriptor

      ServiceDescriptor<T> descriptor()
      Service descriptor of this activator.
      Returns:
      service descriptor
    • instances

      Get instances from this managed service. This method is called when we already know that this service matches the lookup, and we can safely instantiate everything.
      Parameters:
      lookup - lookup to help with narrowing down the instances
      Returns:
      empty optional if an instance is not available, supplier of qualified instances otherwise
    • activate

      ActivationResult activate(ActivationRequest activationRequest)
      Activate a managed service/factory.
      Parameters:
      activationRequest - activation request
      Returns:
      the result of activation
    • deactivate

      ActivationResult deactivate()
      Deactivate a managed service. This will trigger any Service.PreDestroy method on the underlying service instance. The service will reach terminal ActivationPhase.DESTROYED phase, regardless of result of this call.
      Returns:
      the result of deactivation
    • phase

      Current activation phase.
      Returns:
      phase of this activator
    • description

      String description()
      Description of this activator, including the current phase.
      Returns:
      description of this activator