Class TwoPhaseBootstrap<T extends ADEPT2Service>
java.lang.Object
de.aristaflow.adept2.base.service.AbstractADEPT2Service
de.aristaflow.adept2.base.service.AbstractAuthenticatedService
de.aristaflow.adept2.base.registry.AbstractRegistry
de.aristaflow.adept2.base.registry.PluginRegistry
de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
de.aristaflow.adept2.base.registry.LocalServiceRegistry
de.aristaflow.adept2.base.registry.ServiceRegistry
de.aristaflow.adept2.core.registry.BootstrapRegistry
de.aristaflow.adept2.core.registry.twophase.TwoPhaseBootstrap<T>
- Type Parameters:
T- The type of the initial service which is provided after the first phase of bootstrapping.
- All Implemented Interfaces:
GlobalInvocationResolver,GlobalRegistryServiceProvider,ConfMgrRegistry,ADEPT2Service,AuthenticatingService,LogService,NameResolution,ServiceThreadHandling
A bootstrap registry that bootstraps and shuts down in two phases. First the
registry is only bootstrapped to retrieve the initial service provided in the
constructor. Afterwards the second phase of bootstrapping may continue at any
time. Note that the second phase is required before accessing the registry.
The first phase just starts the initial service as well as its required services. Note that the registry cannot be accessed in the first phase since it is not (completely) started. So only basic services may be started in the first phase.
Shutting down may also consist of two inverse phases by using
The first phase just starts the initial service as well as its required services. Note that the registry cannot be accessed in the first phase since it is not (completely) started. So only basic services may be started in the first phase.
Shutting down may also consist of two inverse phases by using
shutdownToInitialService() and BootstrapRegistry.shutdown(boolean). Shutting down
may also be done in one step by just calling BootstrapRegistry.shutdown(boolean). Be sure to
call BootstrapRegistry.shutdown(boolean) in a finally-clause so that it will be
done under all circumstances.
If no initial service is provided, this registry will just act like the
BootstrapRegistry, that is first and second phase will be one
phase.
-
Nested Class Summary
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
ServiceRegistry.ConfigurationValidatorNested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
LocalServiceRegistry.ServiceExportInformation, LocalServiceRegistry.ServiceNameResolution, LocalServiceRegistry.ServiceStarterNested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
PluginRegistry.URLClassloaderPrivilegedActionNested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
AbstractRegistry.DefaultNameResolution, AbstractRegistry.InstanceInformation, AbstractRegistry.InstantiationModeNested classes/interfaces inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
AbstractADEPT2Service.ActiveSessions -
Field Summary
FieldsModifier and TypeFieldDescriptionThe class of the initial service.protected final StringThe type name of the initial service.Fields inherited from class de.aristaflow.adept2.core.registry.BootstrapRegistry
instanceNameFields inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
clusterName, GLOB_STUB_CACHING_REM_IT_ALIVE_TIME_EXTENSION, GLOB_STUB_CACHING_REM_IT_INIT_ALIVE_TIME, GLOB_STUB_PROXY_ANNOT_CACHE_SIZE, GLOB_STUB_PROXY_LAZY_METHOD_VALID_TIME, globalRegCache, hierInstName, protocolPriority, reexportedServicesFields inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
autoStartServices, failedServices, gsmAvailable, nodeName, release, serviceStarterPool, serviceStartLocker, shuttingDown, startedServices, startingLock, startingRequiredServices, startingServiceFields inherited from class de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
usedInstancesFields inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
declaredPluginTypes, defaultInstances, dynamicPlugins, pluginInstances, runtimePlugins, runtimePluginTypeCLs, singletonPluginsFields inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
componentInterfaces, configurationManager, declaredInstances, INIT_INSTANTIATED_OBJECT_METHOD, nameResolution, singletonInstancesFields inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
CFG_EARLY_SERVICEAUTH_ORGPOSID, CFG_EARLY_SERVICEAUTH_ORGPOSNAME, CFG_EARLY_SERVICEAUTH_PASSWORD, CFG_EARLY_SERVICEAUTH_USERNAME, CFG_SERVICEAUTH_ORGPOSID, CFG_SERVICEAUTH_ORGPOSNAME, CFG_SERVICEAUTH_PASSWORD, CFG_SERVICEAUTH_USERNAMEFields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices -
Constructor Summary
ConstructorsConstructorDescriptionTwoPhaseBootstrap(Class<T> initialServiceCls, String initialServiceType, UrlConfigurationManager confMgr, Class<? extends BootstrapRegistry> bootstrapClass) Creates a new bootstrap registry having the designated configuration manager. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPrepares the global security manager, authenticates this registry, provides the data sources for the runtime configurations to the configuration manager if appropriate, and starts all services to be automatically started at startup of this registry.protected voidBootstraps this registry and therefore the platform.protected GlobalRegistryContinues the bootstrap.protected TGets the initial service that is provided in the first phase of bootstrapping.voidShuts down all services until the initial service.Methods inherited from class de.aristaflow.adept2.core.registry.BootstrapRegistry
getClientService, getRegistry, prepareGlobalSecurityManager, resolveInstanceName, shutdown, terminateMethods inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
beforeLocalTermination, checkServiceURI, chooseAppropriateURI, createMBeanName, createRegistryWrapper, exportService, getCommunicationService, getGlobalRegistry, getInstanceNameFromServiceURI, getInvocationTarget, getLocallyExportedService, getLocalServiceObject, getService, getService, getServiceInformation, globalRegistryChanged, init, initExportServices, invalidateGlobalRegistry, prepareExport, prioritiseProtocols, readMetaConfiguration, start, unpublishServiceMethods inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
checkServiceInterface, checkServiceUriSyntax, checkStartupRequiredService, createLocalServiceURI, determineNodeName, getAndCheckRequiredService, getConfiguredPlugin, getGlobalSequence, getInstantiationMode, getRegistry, getSecurityManager, getServiceForInstance, notifyDataSourceToConfMgr, registryActive, renewConfiguration, startLocalService, syncExecute, terminateServiceMethods inherited from class de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
getUsedComponentInstanceNameForInstance, getUsedObjectForInstanceMethods inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
createPluginLoader, getConfiguredPlugin, getConfiguredPlugin, getConfiguredPlugins, getConfiguredPluginTypes, prepareRuntimePlugin, readMetaConfigurationMethods inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
checkAndStoreProvidedObject, checkConfiguration, checkImplementingClass, checkSupertype, createInstanceForInterface, getAppropriateMethod, getArbitrarilyNamedObject, getComponentType, getFormattedSignature, getHierarchicalInstanceName, getInstanceInformation, getInterfaceForComponentType, getNames, getObjectForInstanceName, getObjectForInstanceName, getObjectForInstanceName, getSimpleInstanceName, initialiseInstantiatedObjectMethods inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
_sessionActive, authenticateService, awaitActiveSessions, createChildSession, createSession, getAgent, getSessionFactory, getStartupRequired, getTopLevelAgent, getUserCredentials, globalSecurityManagerAvailable, isEarlyService, sessionHasAllCapabilities, sessionHasAllTopLevelCapabilities, sessionHasOneCapability, sessionHasOneTopLevelCapabilityMethods inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
_sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, 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, ping, preShutdown
-
Field Details
-
initialServiceCls
The class of the initial service. -
initialServiceType
The type name of the initial service.
-
-
Constructor Details
-
TwoPhaseBootstrap
public TwoPhaseBootstrap(Class<T> initialServiceCls, String initialServiceType, UrlConfigurationManager confMgr, Class<? extends BootstrapRegistry> bootstrapClass) throws AbortServiceException Creates a new bootstrap registry having the designated configuration manager. Before creating the registry, the root configuration will be validated against the designated class. If an initial service is provided (via its class and component type name), this registry bootstraps in two phases. In the first phase only the initial service will be retrieved. This will start all services required by the initial service but not the registry itself.- Parameters:
initialServiceCls- The class of the initial service. If this isnull, this registry will act like the normalBootstrapRegistry.initialServiceType- The type name of the initial service. If this isnullor the empty string, this registry will act like the normalBootstrapRegistry.confMgr- The initial configuration manager that provides the root configuration and configurations for the loaded component instances.bootstrapClass- The class the root configuration is validated against the configuration description. Use this class unless you have a subclass that has its own configuration description.- Throws:
AbortServiceException- If the initialisation or starting of the registry fails, anAbortServiceExceptionwill be thrown. If the registry configuration is invalid, aConfigurationExceptionwill be thrown.
-
-
Method Details
-
autoStartServices
Description copied from class:LocalServiceRegistryPrepares the global security manager, authenticates this registry, provides the data sources for the runtime configurations to the configuration manager if appropriate, and starts all services to be automatically started at startup of this registry.- Overrides:
autoStartServicesin classServiceRegistry- Throws:
AbortServiceException- If there are problems preparing the security manager or starting one of the services to be automatically started, anAbortServiceExceptionwill be thrown.
-
getInitialService
Gets the initial service that is provided in the first phase of bootstrapping.- Returns:
- The initial service that is provided in the first phase of
bootstrapping or
nullif no initial service is specified.
-
bootstrap
Description copied from class:BootstrapRegistryBootstraps this registry and therefore the platform. The registry is initialised with either the configured URI or a local URI with the instance name. Afterwards the registry is started.- Overrides:
bootstrapin classBootstrapRegistry- Throws:
AbortServiceException- If the initialisation or starting of the registry fails, anAbortServiceExceptionwill be thrown.
-
continueBootstrap
Continues the bootstrap. This will autostart the services of the superclass.- Returns:
- The global registry which provides access to public services.
- Throws:
AbortServiceException- If there are problems preparing the security manager or starting one of the services to be automatically started, anAbortServiceExceptionwill be thrown.- See Also:
-
shutdownToInitialService
public void shutdownToInitialService()Shuts down all services until the initial service. This can then be used before shutting down completely.
-