Interface ServiceProvider<T extends Service>

All Known Implementing Classes:
PostProcessorRegistryServiceProvider

@Incubating public interface ServiceProvider<T extends Service>
A contract that defines how a service is provided to the ServiceRegistry. It is not uncommon for different objects to have various levels of dependency between one another in a system, and the ServiceProvider allows for the separation of the service registration and the service construction. In essence, the provider is registered with the service registry. Then as services are initialized, they'll request other services that may not have been initialized, and the provider will be called to create such services. This allows the creation of the all services based on their dependency order, and we can in turn tear down the registry in reverse dependency order.
Author:
Chris Cranford
  • Method Details

    • getServiceClass

      Class<T> getServiceClass()
      Get the service class that should be initiated or provided. The service class should be unique in the registry.
      Returns:
      the service class
    • createService

      T createService(Configuration configuration, ServiceRegistry serviceRegistry)
      Creates or provides a desired service.
      Parameters:
      configuration - the connector configuration
      serviceRegistry - the service registry
      Returns:
      the constructed service