Interface ServiceTarget

All Known Subinterfaces:
ServiceContainer, SingletonServiceTarget
All Known Implementing Classes:
DelegatingServiceContainer, DelegatingServiceTarget

public interface ServiceTarget
The target of ServiceBuilder installations. ServiceBuilders to be installed on a target have to be retrieved via addService(ServiceName) method. Service installation will only take place after ServiceBuilder.install() is issued. ServiceBuilders that are not installed will be ignored.

Implementations of this interface are thread safe.

Author:
Flavia Rainone, Richard Opalka
  • Method Details

    • addListener

      ServiceTarget addListener(LifecycleListener listener)
      Add a service lifecycle listener that will be added to this service.
      Parameters:
      listener - the lifecycle listener to add to the service
      Returns:
      this target
    • removeListener

      ServiceTarget removeListener(LifecycleListener listener)
      Remove a lifecycle listener from this target, if it exists.
      Parameters:
      listener - the lifecycle listener to remove
      Returns:
      this target
    • addService

      ServiceBuilder<?> addService()
      Get a builder which can be used to add a service to this target.
      Returns:
      new service configurator
    • subTarget

      ServiceTarget subTarget()
      Create a sub-target using this as the parent target.
      Returns:
      the new service target
    • addService

      ServiceBuilder<?> addService(ServiceName name)
      Deprecated.
      Use addService() instead. This method will be removed in a future release.
      Get a builder which can be used to add a service to this target.
      Parameters:
      name - the service name
      Returns:
      new service configurator
    • addService

      @Deprecated <T> ServiceBuilder<T> addService(ServiceName name, Service<T> service)
      Deprecated.
      Use addService() instead. This method will be removed in a future release.
      Get a builder which can be used to add a service to this target.
      Parameters:
      name - the service name
      service - the service
      Returns:
      the builder for the service
    • addMonitor

      Deprecated.
      Stability monitors are unreliable - do not use them. This method will be removed in a future release.
      Add a stability monitor that will be added to all the ServiceBuilders installed in this target.
      Parameters:
      monitor - the monitor to add to the target
      Returns:
      this target
    • removeMonitor

      @Deprecated ServiceTarget removeMonitor(StabilityMonitor monitor)
      Deprecated.
      Stability monitors are unreliable - do not use them. This method will be removed in a future release.
      Remove a monitor from this target, if it exists.
      Parameters:
      monitor - the monitor to remove
      Returns:
      this target
    • addDependency

      @Deprecated ServiceTarget addDependency(ServiceName dependency)
      Deprecated.
      This method will be removed in a future release.
      Add a dependency that will be added to the all ServiceBuilders installed in this target.
      Parameters:
      dependency - the dependency to add to the target
      Returns:
      this target