services().
The global singleton instance is accessed via injectionServices(). Note that optionally one can provide a
primordial bootstrap configuration to the Injection services provider. One must establish any bootstrap instance
prior to the first call to injectionServices() as it will use a default configuration if not explicitly set. Once
the bootstrap has been set it cannot be changed for the lifespan of the JVM.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ServiceInfoCriteriaDeprecated, for removal: This API element is subject to removal in a future version.Empty criteria will match anything and everything.static final ContextualServiceQueryDeprecated, for removal: This API element is subject to removal in a future version.Denotes a match to any (default) service, but required to be matched to at least one.static final StringDeprecated, for removal: This API element is subject to removal in a future version.Tag for putting Injection tooling, processing, and runtime into debug mode. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Optionally, the service provider activation log.Deprecated, for removal: This API element is subject to removal in a future version.Returns theBootstrapconfiguration instance that was used to initialize this instance.config()Deprecated, for removal: This API element is subject to removal in a future version.The governing configuration.static ActivationRequestDeprecated, for removal: This API element is subject to removal in a future version.Will create an activation request either toPhase.ACTIVEor limited to anyBootstrapBlueprint.limitRuntimePhase()specified.Deprecated, for removal: This API element is subject to removal in a future version.Retrieves any primordial bootstrap configuration that previously set.static voidglobalBootstrap(Bootstrap bootstrap) Deprecated, for removal: This API element is subject to removal in a future version.Sets the primordial bootstrap configuration that will supplyinjectionServices()during global singleton initialization.static Optional<InjectionServices> Deprecated, for removal: This API element is subject to removal in a future version.GetInjectionServicesinstance if available.injector()Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the injector.static booleanDeprecated, for removal: This API element is subject to removal in a future version.Whether debug is enabled.lookups()Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the set ofServiceslookup criteria that were recorded.metrics()Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the metrics that are exposed by the provider implementation.static BootstrapDeprecated, for removal: This API element is subject to removal in a future version.First attempts to locate and return theglobalBootstrap()and if not found will create a new bootstrap instance.static ServicesDeprecated, for removal: This API element is subject to removal in a future version.Short-cut for the following code block.default Servicesservices()Deprecated, for removal: This API element is subject to removal in a future version.The service registry.services(boolean initialize) Deprecated, for removal: This API element is subject to removal in a future version.The service registry.shutdown()Deprecated, for removal: This API element is subject to removal in a future version.Attempts to perform a gracefulInjector.deactivate(Object, InjectorOptions)on all managed service instances in theServicesregistry.static PhaseDeprecated, for removal: This API element is subject to removal in a future version.The terminal phase for activation that we should not cross.Deprecated, for removal: This API element is subject to removal in a future version.Similar toservices(), but here if Injection is not available or the services registry has not yet been initialized then this method will returnOptional.empty().
-
Field Details
-
TAG_DEBUG
Deprecated, for removal: This API element is subject to removal in a future version.Tag for putting Injection tooling, processing, and runtime into debug mode.- See Also:
-
EMPTY_CRITERIA
Deprecated, for removal: This API element is subject to removal in a future version.Empty criteria will match anything and everything. -
SERVICE_QUERY_REQUIRED
Deprecated, for removal: This API element is subject to removal in a future version.Denotes a match to any (default) service, but required to be matched to at least one.
-
-
Method Details
-
isDebugEnabled
static boolean isDebugEnabled()Deprecated, for removal: This API element is subject to removal in a future version.Whether debug is enabled.- Returns:
- whether to debug
-
bootstrap
Bootstrap bootstrap()Deprecated, for removal: This API element is subject to removal in a future version.Returns theBootstrapconfiguration instance that was used to initialize this instance.- Returns:
- the bootstrap configuration instance
-
globalBootstrap
Deprecated, for removal: This API element is subject to removal in a future version.Retrieves any primordial bootstrap configuration that previously set.- Returns:
- the bootstrap primordial configuration already assigned
- See Also:
-
realizedGlobalBootStrap
Deprecated, for removal: This API element is subject to removal in a future version.First attempts to locate and return theglobalBootstrap()and if not found will create a new bootstrap instance.- Returns:
- a bootstrap
-
globalBootstrap
Deprecated, for removal: This API element is subject to removal in a future version.Sets the primordial bootstrap configuration that will supplyinjectionServices()during global singleton initialization.- Parameters:
bootstrap- the primordial global bootstrap configuration- See Also:
-
injectionServices
Deprecated, for removal: This API element is subject to removal in a future version.GetInjectionServicesinstance if available. The highestWeightedservice will be loaded and returned. Remember to optionally configure any primordialBootstrapconfiguration prior to the first call to getInjectionServices.- Returns:
- the services instance
-
realizedServices
Deprecated, for removal: This API element is subject to removal in a future version.Short-cut for the following code block. During the first invocation theServicesregistry will be initialized.return injectionServices().orElseThrow().services();- Returns:
- the services instance
-
unrealizedServices
Deprecated, for removal: This API element is subject to removal in a future version.Similar toservices(), but here if Injection is not available or the services registry has not yet been initialized then this method will returnOptional.empty(). This is convenience for users who conditionally want to use Injection's service registry if it is currently available and in active use, but if not do alternative processing or allocations directly, etc.- Returns:
- the services instance if it has already been activated and initialized, empty otherwise
-
services
Deprecated, for removal: This API element is subject to removal in a future version.The service registry. The first call typically loads and initializes the service registry. To avoid automatic loading and initialization on any first request then consider usingunrealizedServices()orservices(boolean).- Returns:
- the services registry
-
services
Deprecated, for removal: This API element is subject to removal in a future version.The service registry. The first call typically loads and initializes the service registry.- Parameters:
initialize- true to allow initialization applicable for the 1st request, false to prevent 1st call initialization- Returns:
- the services registry if it is available and already has been initialized, empty if not yet initialized
-
config
InjectionServicesConfig config()Deprecated, for removal: This API element is subject to removal in a future version.The governing configuration.- Returns:
- the config
-
injector
Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the injector.- Returns:
- the injector, or empty if not available
-
shutdown
Optional<Map<TypeName,ActivationResult>> shutdown()Deprecated, for removal: This API element is subject to removal in a future version.Attempts to perform a gracefulInjector.deactivate(Object, InjectorOptions)on all managed service instances in theServicesregistry. Deactivation is handled within the current thread.If the service provider does not support shutdown an empty is returned.
The default reference implementation will return a map of all service types that were deactivated to any throwable that was observed during that services shutdown sequence.
The order in which services are deactivated is dependent upon whether the
activationLog()is available. If the activation log is available, then services will be shutdown in reverse chronological order as how they were started. If the activation log is not enabled or found to be empty then the deactivation will be in reverse order ofRunLevelfrom the highest value down to the lowest value. If two services share the sameRunLevelvalue then the ordering will be based upon the implementation's comparator.When shutdown returns, it is guaranteed that all services were shutdown, or failed to achieve shutdown.
The shutdown timeout from
InjectionServicesConfigBlueprint.shutdownTimeout()will be applied as the default.- Returns:
- a map of all managed service types deactivated to results of deactivation, or empty if shutdown is not supported
-
activationLog
Optional<ActivationLog> activationLog()Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the service provider activation log.- Returns:
- the injector, or empty if not available
-
metrics
Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the metrics that are exposed by the provider implementation.- Returns:
- the metrics, or empty if not available
-
lookups
Optional<Set<ServiceInfoCriteria>> lookups()Deprecated, for removal: This API element is subject to removal in a future version.Optionally, the set ofServiceslookup criteria that were recorded. This is only available ifInjectionServicesConfigBlueprint.serviceLookupCaching()is enabled.- Returns:
- the lookup criteria recorded, or empty if not available
-
createActivationRequestDefault
Deprecated, for removal: This API element is subject to removal in a future version.Will create an activation request either toPhase.ACTIVEor limited to anyBootstrapBlueprint.limitRuntimePhase()specified.- Returns:
- the activation request
-
terminalActivationPhase
Deprecated, for removal: This API element is subject to removal in a future version.The terminal phase for activation that we should not cross.- Returns:
- the terminal phase for activation
-