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
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.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
AbstractADEPT2Service.ActiveSessions -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConfiguration key for the URIs of the possible global registries.static final StringConfiguration key for the time in milliseconds to wait for the requested URIs.protected final ExecutorServiceThe executor service that requests a global registry for a specific URI while the registry is starting or shutting down.The URIs of the possible global registries.protected final ExecutorServiceThe executor service that requests a global registry for a specific URI while the registry is active.protected final longThe time in milliseconds to wait for the service requests.Fields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices -
Constructor Summary
ConstructorsConstructorDescriptionRegistryProviderConf(Configuration conf, Registry registry) 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. -
Method Summary
Modifier and TypeMethodDescriptionURI[]getGlobalRegistry(SessionToken session) Gets the URIs of the current global registry.voidshutdown(boolean emergency) This implementation waits 10 seconds in case of an emergency and otherwise indefinitely for the termination of the active sessions.Methods inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
_sessionActive, _sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, getUserCredentials, init, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, start, unprivilegeThreadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, start
-
Field Details
-
CONF_GLOBAL_REGISTRY_URIS
Configuration key for the URIs of the possible global registries.- See Also:
-
CONF_TIMEOUT
Configuration key for the time in milliseconds to wait for the requested URIs.- See Also:
-
globRegUris
The URIs of the possible global registries. -
requests
The executor service that requests a global registry for a specific URI while the registry is active. -
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 timeoutThe 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
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, anAbortServiceExceptionwill be thrown.
-
-
Method Details
-
shutdown
public void shutdown(boolean emergency) Description copied from class:AbstractADEPT2ServiceThis 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:
shutdownin interfaceADEPT2Service- Overrides:
shutdownin classAbstractADEPT2Service- Parameters:
emergency- Whether the shutdown will be an emergency shutdown.
-
getGlobalRegistry
Description copied from interface:GlobalRegistryProviderGets the URIs of the current global registry.- Specified by:
getGlobalRegistryin interfaceGlobalRegistryProvider- 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, aServiceNotKnownExceptionwill be thrown.
-