Package org.jboss.msc.service
The service container implementation itself. The service container is what coordinates the registry of services and
manages their installation and execution. To create a service container, see
ServiceContainer.Factory.create()
.
To create services, implement the Service
interface.
Individual service instances are controlled using the ServiceController
interface. Service controllers follow
this strict internal state machine:
The green boxes represent states; the red boxes below them represent possible transitions. The "When:" condition must be satisfied before a transition is taken; if it is, then the asynchronous tasks listed under "Tasks:" are executed.
The variables are what determine when a transition may occur; any time a variable is changed, the conditions are checked to see if a transition can occur. The variables are as follows:
- A: The number of currently running asynchronous tasks.
- R: The number of running children (dependents).
- D: The number of "demands" from children, used to trigger the start of
ON_DEMAND
services. If greater than zero, a single "demand" is propagated to the dependency set (parents) of this service. - U: The count, from zero, representing the desire of the service to be "up". Only services with a positive "up" count will start.
- X: The exception produced by the service
start()
method, if any. - MODE: The controller start mode. Values can be one of:
ACTIVE
- attempt to start immediately, and request all parents (dependencies) to start as well by incrementing their "demand" count (D). Puts a load of+1
on U always.PASSIVE
- attempt to start immediately if all dependencies are up. Puts a load of+1
on U always.ON_DEMAND
- only start a service if demanded. Puts a load of+1
on U only if D is greater than zero.NEVER
- never start. The value of U is not affected and not considered. The value of D is disregarded; if D was greater than zero, then the existing "demand" on the dependency set (parents) is revoked and further "demands" are suppressed until this mode is left.REMOVE
- the same asNEVER
; in addition, remove the service as soon as it is down. The mode may not be changed again after setting this mode.
-
Interface Summary Interface Description BatchServiceTarget Deprecated. this class will be removed in a future release.LifecycleContext A context object for lifecycle events.LifecycleListener A listener for service lifecycle events.MultipleRemoveListener.Callback<T> A generalized callback for when all services are removed.Service<T> Deprecated. useService
instead.ServiceActivator A service activator which contributes services to a batch.ServiceActivatorContext Context provided to ServiceActivator instances at execution time.ServiceBuilder<T> Builder to configure service before installing it into the container.ServiceContainer A service container which manages a set of running services.ServiceContainer.TerminateListener A listener for notification of container shutdown.ServiceController<S> A controller for a single service instance.ServiceListener<S> Deprecated. Service listeners are not encouraged for general user use.ServiceRegistry A service registry.ServiceTarget The target of ServiceBuilder installations.StartContext The start lifecycle context.StopContext The stop lifecycle context. -
Class Summary Class Description AbstractService<T> Deprecated. useService
instead.AbstractServiceListener<S> Deprecated. Service listeners are not encouraged for general user use.DelegatingServiceBuilder<T> A service builder which delegates to another service builder.DelegatingServiceContainer A delegating container for things which depend on a service container rather than a specific target or registry instance.DelegatingServiceController<S> A service controller which delegates to another service controller.DelegatingServiceRegistry A service registry which delegates to another service registry.DelegatingServiceTarget A service target which delegates to another service target.MultipleRemoveListener<T> Deprecated. Service listeners are not encouraged for general user use.ServiceActivatorContextImpl A simple service activator context implementation.ServiceContainer.Factory The factory class for service containers.ServiceContainer.TerminateListener.Info Container shutdown information.ServiceLogger_$logger Warning this class consists of generated code.ServiceName Service name class.ServiceNameMapper<V> Deprecated. This class will be removed in a future release.ServiceUtils Deprecated. This class will be removed in a future release.StabilityMonitor Deprecated. Stability monitors are unreliable - do not use them.StabilityStatistics Deprecated. Stability monitors are unreliable - do not use them.TimingServiceListener Deprecated. UseLifecycleContext.getElapsedTime()
insteadValueInjection<T> Deprecated. ValueInjectionService<T> Deprecated. UseService.newInstance(Consumer<T>,T
instead.ValueService<T> Deprecated. UseService.newInstance(Consumer<T>,T
instead. -
Enum Summary Enum Description LifecycleEvent Service lifecycle events.ServiceBuilder.DependencyType Deprecated. Optional dependencies are unsafe and should not be used.ServiceController.Mode The controller mode for a service.ServiceController.State A possible state for a service controller.ServiceController.Substate Deprecated. this class will be removed in a future releaseServiceController.Transition Deprecated. this class will be removed in a future release -
Exception Summary Exception Description CircularDependencyException Exception used to indicate there was a circular dependency discovered during resolution.DuplicateServiceException An exception which is thrown when the given service is already registered.ServiceNotFoundException Exception which is thrown when a required service is not found in the registry.ServiceRegistryException Base Exception class used for service registry issues.StartException A start exception, thrown when a service fails to start.