T
- service value type if service provides single valuepublic interface ServiceBuilder<T>
Service may require multiple dependencies (named values) to be satisfied before starting.
Every dependency requirement must be specified via requires(ServiceName)
method.
Single service can provide multiple values which can be requested by dependent services.
Every named value service provides must be specified via provides(ServiceName...)
method.
Once all required and provided dependencies are defined, references to all Consumer
s
and Supplier
s should be passed to service instance so they can be accessed by service
at runtime.
Implementations of this interface are not thread safe.
Modifier and Type | Interface and Description |
---|---|
static class |
ServiceBuilder.DependencyType
Deprecated.
Optional dependencies are unsafe and should not be used.
This enum will be removed in a future release.
|
Modifier and Type | Method and Description |
---|---|
ServiceBuilder<T> |
addAliases(ServiceName... aliases)
Adds aliases for this service.
|
ServiceBuilder<T> |
addDependencies(Iterable<ServiceName> dependencies)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addDependencies(ServiceBuilder.DependencyType dependencyType,
Iterable<ServiceName> dependencies)
Deprecated.
Optional dependencies are unsafe and should not be used.
This method will be removed in a future release.
|
ServiceBuilder<T> |
addDependencies(ServiceBuilder.DependencyType dependencyType,
ServiceName... dependencies)
Deprecated.
Optional dependencies are unsafe and should not be used.
This method will be removed in a future release.
|
ServiceBuilder<T> |
addDependencies(ServiceName... dependencies)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addDependency(ServiceBuilder.DependencyType dependencyType,
ServiceName dependency)
Deprecated.
Optional dependencies are unsafe and should not be used.
This method will be removed in a future release.
|
<I> ServiceBuilder<T> |
addDependency(ServiceBuilder.DependencyType dependencyType,
ServiceName dependency,
Class<I> type,
Injector<I> target)
Deprecated.
Optional dependencies are unsafe and should not be used.
This method will be removed in a future release.
|
ServiceBuilder<T> |
addDependency(ServiceBuilder.DependencyType dependencyType,
ServiceName dependency,
Injector<Object> target)
Deprecated.
Optional dependencies are unsafe and should not be used.
This method will be removed in a future release.
|
ServiceBuilder<T> |
addDependency(ServiceName dependency)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
<I> ServiceBuilder<T> |
addDependency(ServiceName dependency,
Class<I> type,
Injector<I> target)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addDependency(ServiceName dependency,
Injector<Object> target)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
<I> ServiceBuilder<T> |
addInjection(Injector<? super I> target,
I value)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addInjection(Injector<? super T> target)
Deprecated.
Use
provides(ServiceName...) instead.
This method will be removed in a future release. |
<I> ServiceBuilder<T> |
addInjectionValue(Injector<? super I> target,
Value<I> value)
Deprecated.
Use
requires(ServiceName) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addListener(Collection<? extends ServiceListener<? super T>> listeners)
Deprecated.
Use
addListener(LifecycleListener) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addListener(LifecycleListener listener)
Adds a service listener to be added to the service.
|
ServiceBuilder<T> |
addListener(ServiceListener<? super T>... listeners)
Deprecated.
Use
addListener(LifecycleListener) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addListener(ServiceListener<? super T> listener)
Deprecated.
Use
addListener(LifecycleListener) instead.
This method will be removed in a future release. |
ServiceBuilder<T> |
addMonitor(StabilityMonitor monitor)
Adds a stability monitor to be added to the service.
|
ServiceBuilder<T> |
addMonitors(StabilityMonitor... monitors)
Deprecated.
Use
addMonitor(StabilityMonitor) instead.
This method will be removed in a future release. |
ServiceController<T> |
install()
Installs configured service into the container.
|
<V> Consumer<V> |
provides(ServiceName... names)
Specifies injector provided by service.
|
<V> Supplier<V> |
requires(ServiceName name)
Specifies dependency value required by service.
|
ServiceBuilder<T> |
setInitialMode(ServiceController.Mode mode)
Sets initial service mode.
|
ServiceBuilder<T> |
setInstance(Service service)
Sets service instance.
|
ServiceBuilder<T> addAliases(ServiceName... aliases)
aliases
- the service names to use as aliasesUnsupportedOperationException
- if this service builder
wasn't created via ServiceTarget.addService(ServiceName)
method.<V> Supplier<V> requires(ServiceName name)
V
- required dependency value typename
- required dependency nameIllegalStateException
- if this method
have been called after setInstance(org.jboss.msc.Service)
method.UnsupportedOperationException
- if this service builder
wasn't created via ServiceTarget.addService(ServiceName)
method.<V> Consumer<V> provides(ServiceName... names)
V
- provided dependency value typenames
- provided dependency namesIllegalStateException
- if this method
have been called after setInstance(org.jboss.msc.Service)
method.UnsupportedOperationException
- if this service builder
wasn't created via ServiceTarget.addService(ServiceName)
method.ServiceBuilder<T> setInitialMode(ServiceController.Mode mode)
mode
- initial service modeServiceBuilder<T> setInstance(Service service)
install()
method call is issued
without this method being called then NULL
service will be
installed into the container.
When this method have been called then all subsequent
calls of requires(ServiceName)
, and provides(ServiceName...)
methods will fail.
service
- the service instanceServiceBuilder<T> addMonitor(StabilityMonitor monitor)
monitor
- the monitor to add to the serviceServiceBuilder<T> addListener(LifecycleListener listener)
listener
- the listener to add to the serviceServiceController<T> install()
ServiceRegistryException
- if installation fails for any reason@Deprecated ServiceBuilder<T> addDependencies(ServiceName... dependencies)
requires(ServiceName)
instead.
This method will be removed in a future release.dependencies
- the service names to depend onUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType, ServiceName... dependencies)
dependencyType
- the dependency type; must not be null
dependencies
- the service names to depend onUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependencies(Iterable<ServiceName> dependencies)
requires(ServiceName)
instead.
This method will be removed in a future release.dependencies
- the service names to depend onUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType, Iterable<ServiceName> dependencies)
dependencyType
- the dependency type; must not be null
dependencies
- the service names to depend onUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependency(ServiceName dependency)
requires(ServiceName)
instead.
This method will be removed in a future release.dependency
- the name of the dependencyUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency)
dependencyType
- the dependency type; must not be null
dependency
- the name of the dependencyUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependency(ServiceName dependency, Injector<Object> target)
requires(ServiceName)
instead.
This method will be removed in a future release.dependency
- the name of the dependencytarget
- the injector into which the dependency should be storedUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, Injector<Object> target)
dependencyType
- the dependency type; must not be null
dependency
- the name of the dependencytarget
- the injector into which the dependency should be storedUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated <I> ServiceBuilder<T> addDependency(ServiceName dependency, Class<I> type, Injector<I> target)
requires(ServiceName)
instead.
This method will be removed in a future release.I
- the type of the value of the dependencydependency
- the name of the dependencytype
- the class of the value of the dependencytarget
- the injector into which the dependency should be storedUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated <I> ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, Class<I> type, Injector<I> target)
I
- the type of the value of the dependencydependencyType
- the dependency type; must not be null
dependency
- the name of the dependencytype
- the class of the value of the dependencytarget
- the injector into which the dependency should be storedUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated <I> ServiceBuilder<T> addInjection(Injector<? super I> target, I value)
requires(ServiceName)
instead.
This method will be removed in a future release.I
- the injection typetarget
- the injection targetvalue
- the injection valueUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated <I> ServiceBuilder<T> addInjectionValue(Injector<? super I> target, Value<I> value)
requires(ServiceName)
instead.
This method will be removed in a future release.I
- the injection typetarget
- the injection targetvalue
- the injection valueUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addInjection(Injector<? super T> target)
provides(ServiceName...)
instead.
This method will be removed in a future release.Differently from other injection types, failures to perform an outward injection will not result in a failure to start the service.
target
- the injector targetUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addMonitors(StabilityMonitor... monitors)
addMonitor(StabilityMonitor)
instead.
This method will be removed in a future release.monitors
- a list of stability monitors to add to the serviceUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addListener(ServiceListener<? super T> listener)
addListener(LifecycleListener)
instead.
This method will be removed in a future release.listener
- the listener to add to the serviceUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addListener(ServiceListener<? super T>... listeners)
addListener(LifecycleListener)
instead.
This method will be removed in a future release.listeners
- a list of listeners to add to the serviceUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.@Deprecated ServiceBuilder<T> addListener(Collection<? extends ServiceListener<? super T>> listeners)
addListener(LifecycleListener)
instead.
This method will be removed in a future release.listeners
- a collection of listeners to add to the serviceUnsupportedOperationException
- if this service builder
was created via ServiceTarget.addService(ServiceName)
method.Copyright © 2019 JBoss by Red Hat. All rights reserved.