Class RegistryProviderConf

java.lang.Object
de.aristaflow.adept2.base.service.AbstractADEPT2Service
de.aristaflow.adept2.base.cluster.RegistryProviderConf
All Implemented Interfaces:
GlobalRegistryProvider, ADEPT2Service, LogService, ServiceThreadHandling

@ConfigurationDescription(properties={@Property(name="GlobalRegistryUris",type=STRING,isRequired=true,description="A list of URIs that refer to global registries running on the available cluster nodes. At most one of the URIs will be valid at a time."),}) public class RegistryProviderConf extends AbstractADEPT2Service implements GlobalRegistryProvider
A GlobalRegistryProvider retrieving a list of possible global registry URIs from its configuration and trying to get a global registry with this URIs. That is, you configure a list of all possible global registry URIs and this global registry provider retrieves one of them.
Each URI is requested concurrently, the first successful retrieval of a global registry succeeds, that is, these URIs will be returned. The configured timeout applies to all requests accumulated, that is, retrieval of a global registry will not exceed this timeout.
  • Field Details

    • CONF_GLOBAL_REGISTRY_URIS

      public static final String CONF_GLOBAL_REGISTRY_URIS
      Configuration key for the URIs of the possible global registries.
      See Also:
    • CONF_TIMEOUT

      public static final String CONF_TIMEOUT
      Configuration key for the time in milliseconds to wait for the requested URIs.
      See Also:
    • globRegUris

      protected final List<URI> globRegUris
      The URIs of the possible global registries.
    • requests

      protected final ExecutorService requests
      The executor service that requests a global registry for a specific URI while the registry is active.
    • earlyRequests

      protected final ExecutorService earlyRequests
      The executor service that requests a global registry for a specific URI while the registry is starting or shutting down.
      This executor service runs all tasks in the calling thread. This is required for requests that occur before the registry has signalled its start or while it is shutting down. In this case, only the requesting thread may access the registry since it is privileged. All other threads will block when accessing the registry.
    • timeout

      protected final long timeout
      The time in milliseconds to wait for the service requests. Waiting for the requests will be accumulated, so waiting time for all requests will not exceed this timeout.
  • Constructor Details

    • RegistryProviderConf

      public RegistryProviderConf(Configuration conf, Registry registry) throws AbortServiceException
      Creates a new global registry provider retrieving the global registry URIs from the designated configuration, trying to retrieve a valid global registry from these when requested.
      Parameters:
      conf - The configuration of this service.
      registry - The registry of this service.
      Throws:
      AbortServiceException - If there are no global registry URIs configured or they are not valid, an AbortServiceException will be thrown.
  • Method Details

    • shutdown

      public void shutdown(boolean emergency)
      Description copied from class: AbstractADEPT2Service
      This implementation waits 10 seconds in case of an emergency and otherwise indefinitely for the termination of the active sessions. In case of an emergency shutdown may proceed even if there are active sessions.
      Specified by:
      shutdown in interface ADEPT2Service
      Overrides:
      shutdown in class AbstractADEPT2Service
      Parameters:
      emergency - Whether the shutdown will be an emergency shutdown.
    • getGlobalRegistry

      public URI[] getGlobalRegistry(SessionToken session) throws ServiceNotKnownException
      Description copied from interface: GlobalRegistryProvider
      Gets the URIs of the current global registry.
      Specified by:
      getGlobalRegistry in interface GlobalRegistryProvider
      Parameters:
      session - The session which is used to check for access rights on this method.
      Returns:
      The URIs of the current global registry.
      Throws:
      ServiceNotKnownException - If there is currently no global registry, a ServiceNotKnownException will be thrown.