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 AServiceTarget
that providesremoval
of all services installed so far.Dependency AbstractDependency represents the dependencies of a service.Dependent Depends on one or more dependencies, represented byAbstractDependency
.LifecycleContext A context object for lifecycle events.MultipleRemoveListener.Callback<T> A generalized callback for when all services are removed.Service<T> A service is a thing which can be started and stopped.ServiceActivator A service activator which contributes services to a batch.ServiceActivatorContext Context provided to ServiceActivator instances at execution time.ServiceBuilder<T> A builder for an individual service in aServiceTarget
.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.ServiceLogger The logger interface for the service controller.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> An abstract service class which provides default implementations.AbstractServiceListener<S> An abstract implementation of a service listener whose methods do nothing.BatchServiceTargetImpl BatchServiceTarget
implementation.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.DelegatingServiceRegistry An "insulated" view of a service registry which prevents access to other public methods on the delegate registry object.DelegatingServiceTarget An "insulated" view of a service target which prevents access to other public methods on the delegate target object.IdentityHashSet<E> An identity based hash set.MultipleRemoveListener<T> A service listener which calls a callback once all of the services it was attached to have been removed.NullService OptionalDependency An OptionalDependency.
This class establishes a transitive dependency relationship between the dependent and the real dependency.ServiceActivatorContextImpl A simple service activator context implementation.ServiceBuilderImpl<T> ServiceBuilder
implementation.ServiceBuilderImpl.Dependency ServiceContainer.Factory The factory class for service containers.ServiceContainer.TerminateListener.Info Container shutdown information.ServiceContainerImpl ServiceContainerImpl.LatchListener ServiceContainerImpl.ServiceThread ServiceContainerImpl.ShutdownHookHolder ServiceControllerImpl<S> The service controller implementation.ServiceLogger_$logger Warning this class consists of generated code.ServiceName Service name class.ServiceNameMapper<V> A mapper for service names which allows a service name or pattern to be correlated with a value.ServiceNameMapper.Node<V> ServiceRegistrationImpl A single service registration.ServiceTargetImpl Abstract base class used for ServiceTargets.ServiceUtils A utility class for service actions.SetTCCLAction StabilityMonitor A stability detection utility.StabilityStatistics A stability monitor statistics.TimingServiceListener A service listener which times service start.UnlockedReadHashMap<K,V> A hash map that supports non-blocking, lockless read access.UnlockedReadHashMap.Item<K,V> ValueInjection<T> An injection of a source value into a target injector.ValueInjectionService<T> A service which propagates a value from a dependency.ValueService<T> A service which returns the provided value, which is evaluated once per service start. -
Enum Summary Enum Description OptionalDependency.DependencyState One of the states of a dependency from the dependent point of view (i.e., based on notifications made by the dependency).ServiceBuilder.DependencyType The dependency type.ServiceController.Mode The controller mode for a service.ServiceController.State A possible state for a service controller.ServiceController.Substate A fine-grained substate of the more general basic controllerServiceController.State
s.ServiceController.Transition A transition from one substate to another.ServiceControllerImpl.ContextState ServiceControllerImpl.ListenerNotification -
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.