public class DelegatingServiceContainer extends java.lang.Object implements ServiceContainer
ServiceContainer.Factory, ServiceContainer.TerminateListener| Constructor and Description |
|---|
DelegatingServiceContainer(ServiceTarget serviceTargetDelegate,
ServiceRegistry serviceRegistryDelegate)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
ServiceContainer |
addDependency(java.util.Collection<ServiceName> dependencies)
Add a collection of dependencies that will be added to the all ServiceBuilders installed in this target
|
ServiceContainer |
addDependency(ServiceName... dependencies)
Add a list of dependencies that will be added to the all ServiceBuilders installed in this target.
|
ServiceContainer |
addDependency(ServiceName dependency)
Add a dependency that will be added to the all ServiceBuilders installed in this target.
|
ServiceContainer |
addListener(java.util.Collection<ServiceListener<java.lang.Object>> listeners)
Deprecated.
|
ServiceContainer |
addListener(LifecycleListener listener)
Add a service lifecycle listener that will be added to this service.
|
ServiceContainer |
addListener(ServiceListener<java.lang.Object>... listeners)
Deprecated.
|
ServiceContainer |
addListener(ServiceListener<java.lang.Object> listener)
Deprecated.
|
ServiceTarget |
addMonitor(StabilityMonitor monitor)
Add a stability monitor that will be added to all the ServiceBuilders installed in this target.
|
ServiceTarget |
addMonitors(StabilityMonitor... monitors)
Add a stability monitors that will be added to all the ServiceBuilders installed in this target.
|
<T> ServiceBuilder<T> |
addService(ServiceName name,
Service<T> service)
Get a builder which can be used to add a service to this target.
|
<T> ServiceBuilder<T> |
addServiceValue(ServiceName name,
Value<? extends Service<T>> value)
Get a builder which can be used to add a service to this target.
|
void |
addTerminateListener(ServiceContainer.TerminateListener listener)
Add a terminate listener to this container.
|
void |
awaitStability()
Causes the current thread to wait until the container is stable.
|
boolean |
awaitStability(long timeout,
java.util.concurrent.TimeUnit unit)
Causes the current thread to wait until the container is stable.
|
boolean |
awaitStability(long timeout,
java.util.concurrent.TimeUnit unit,
java.util.Set<? super ServiceController<?>> failed,
java.util.Set<? super ServiceController<?>> problem)
Causes the current thread to wait until the container is stable.
|
void |
awaitStability(java.util.Set<? super ServiceController<?>> failed,
java.util.Set<? super ServiceController<?>> problem)
Causes the current thread to wait until the container is stable.
|
void |
awaitTermination()
Causes the current thread to wait until the container is shutdown.
|
void |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
Causes the current thread to wait until the container is shutdown.
|
BatchServiceTarget |
batchTarget()
Create a new batch service target, which is used to install described services in this target.
|
void |
dumpServices()
Dump a complete list of services to
System.out. |
void |
dumpServices(java.io.PrintStream stream)
Dump a complete list of services to the given stream.
|
java.util.Set<ServiceName> |
getDependencies()
Returns a set of all dependencies added to this target.
|
java.util.Set<ServiceListener<java.lang.Object>> |
getListeners()
Returns a set of the listeners added to this target.
|
java.util.Set<StabilityMonitor> |
getMonitors()
Returns a set of the monitors added to this target.
|
java.lang.String |
getName()
Get the name of this service container.
|
ServiceController<?> |
getRequiredService(ServiceName serviceName)
Get a service, throwing an exception if it is not found.
|
ServiceController<?> |
getService(ServiceName serviceName)
Get a service, returning
null if it is not found. |
java.util.List<ServiceName> |
getServiceNames()
Get a list of service names installed in this registry.
|
protected ServiceRegistry |
getServiceRegistryDelegate()
Get the ServiceRegistry delegate.
|
protected ServiceTarget |
getServiceTargetDelegate()
Get the ServiceTarget delegate.
|
boolean |
isShutdown()
Whether container have been shut down.
|
boolean |
isShutdownComplete()
Determine whether the container is completely shut down.
|
ServiceContainer |
removeDependency(ServiceName dependency)
Remove a dependency from this target.
|
ServiceContainer |
removeListener(LifecycleListener listener)
Remove a lifecycle listener from this target, if it exists.
|
ServiceContainer |
removeListener(ServiceListener<java.lang.Object> listener)
Deprecated.
|
ServiceTarget |
removeMonitor(StabilityMonitor monitor)
Remove a monitor from this target, if it exists.
|
void |
shutdown()
Stop all services within this container.
|
ServiceTarget |
subTarget()
Create a sub-target using this as the parent target.
|
public DelegatingServiceContainer(ServiceTarget serviceTargetDelegate, ServiceRegistry serviceRegistryDelegate)
serviceTargetDelegate - the delegate to forward service target requests toserviceRegistryDelegate - the delegate to forward registry requests toprotected ServiceTarget getServiceTargetDelegate()
protected ServiceRegistry getServiceRegistryDelegate()
public <T> ServiceBuilder<T> addServiceValue(ServiceName name, Value<? extends Service<T>> value) throws java.lang.IllegalArgumentException
addServiceValue in interface ServiceTargetname - the service namevalue - the service valuejava.lang.IllegalArgumentExceptionpublic <T> ServiceBuilder<T> addService(ServiceName name, Service<T> service) throws java.lang.IllegalArgumentException
addService in interface ServiceTargetname - the service nameservice - the servicejava.lang.IllegalArgumentExceptionpublic ServiceContainer addListener(LifecycleListener listener)
addListener in interface ServiceTargetlistener - the lifecycle listener to add to the service@Deprecated public ServiceContainer addListener(ServiceListener<java.lang.Object> listener)
addListener in interface ServiceTargetlistener - the listener to add to the target@Deprecated public ServiceContainer addListener(ServiceListener<java.lang.Object>... listeners)
addListener in interface ServiceTargetlisteners - a list of listeners to add to the target@Deprecated public ServiceContainer addListener(java.util.Collection<ServiceListener<java.lang.Object>> listeners)
addListener in interface ServiceTargetlisteners - a collection of listeners to add to the targetpublic ServiceContainer removeListener(LifecycleListener listener)
removeListener in interface ServiceTargetlistener - the lifecycle listener to remove@Deprecated public ServiceContainer removeListener(ServiceListener<java.lang.Object> listener)
removeListener in interface ServiceTargetlistener - the listener to removepublic java.util.Set<ServiceListener<java.lang.Object>> getListeners()
getListeners in interface ServiceTargetpublic ServiceTarget addMonitor(StabilityMonitor monitor)
addMonitor in interface ServiceTargetmonitor - the monitor to add to the targetpublic ServiceTarget addMonitors(StabilityMonitor... monitors)
addMonitors in interface ServiceTargetmonitors - the monitors to add to the targetpublic ServiceTarget removeMonitor(StabilityMonitor monitor)
removeMonitor in interface ServiceTargetmonitor - the monitor to removepublic java.util.Set<StabilityMonitor> getMonitors()
getMonitors in interface ServiceTargetpublic ServiceContainer addDependency(ServiceName dependency)
addDependency in interface ServiceTargetdependency - the dependency to add to the targetpublic ServiceContainer addDependency(ServiceName... dependencies)
addDependency in interface ServiceTargetdependencies - a list of dependencies to add to the targetpublic ServiceContainer addDependency(java.util.Collection<ServiceName> dependencies)
addDependency in interface ServiceTargetdependencies - a collection of dependencies to add to this targetpublic ServiceContainer removeDependency(ServiceName dependency)
removeDependency in interface ServiceTargetdependency - the dependencypublic java.util.Set<ServiceName> getDependencies()
getDependencies in interface ServiceTargetpublic ServiceTarget subTarget()
subTarget in interface ServiceTargetpublic BatchServiceTarget batchTarget()
batchTarget in interface ServiceTargetpublic ServiceController<?> getRequiredService(ServiceName serviceName) throws ServiceNotFoundException
getRequiredService in interface ServiceRegistryserviceName - the service nameServiceNotFoundException - if the service is not present in the registrypublic ServiceController<?> getService(ServiceName serviceName)
null if it is not found.getService in interface ServiceRegistryserviceName - the service namenull if it is not foundpublic java.util.List<ServiceName> getServiceNames()
getServiceNames in interface ServiceRegistrypublic java.lang.String getName()
getName in interface ServiceContainerpublic void shutdown()
shutdown in interface ServiceContainerpublic boolean isShutdown()
isShutdown in interface ServiceContainertrue if container is shutting downpublic boolean isShutdownComplete()
isShutdownComplete in interface ServiceContainertrue if shutdown is completepublic void dumpServices()
System.out.dumpServices in interface ServiceContainerpublic void dumpServices(java.io.PrintStream stream)
dumpServices in interface ServiceContainerstream - the stream to which the service list should be writtenpublic void addTerminateListener(ServiceContainer.TerminateListener listener)
listener will be invoked when this container shutdown process is complete.addTerminateListener in interface ServiceContainerlistener - the listenerpublic void awaitTermination()
awaitTermination in interface ServiceContainerpublic void awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface ServiceContainertimeout - the maximum time to waitunit - the time unit of the timeout argumentjava.lang.InterruptedException - if the current thread is interrupted
while waitingpublic void awaitStability()
throws java.lang.InterruptedException
awaitStability in interface ServiceContainerjava.lang.InterruptedException - if the current thread is interrupted
while waitingpublic boolean awaitStability(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitStability in interface ServiceContainertimeout - the maximum time to waitunit - the time unit of the timeout argumentjava.lang.InterruptedException - if the current thread is interrupted
while waitingpublic void awaitStability(java.util.Set<? super ServiceController<?>> failed, java.util.Set<? super ServiceController<?>> problem) throws java.lang.InterruptedException
awaitStability in interface ServiceContainerfailed - a set into which failed services should be copiedproblem - a set into which problem services should be copiedjava.lang.InterruptedException - if the current thread is interrupted
while waitingpublic boolean awaitStability(long timeout,
java.util.concurrent.TimeUnit unit,
java.util.Set<? super ServiceController<?>> failed,
java.util.Set<? super ServiceController<?>> problem)
throws java.lang.InterruptedException
awaitStability in interface ServiceContainertimeout - the maximum time to waitunit - the time unit of the timeout argumentfailed - a set into which failed services should be copiedproblem - a set into which problem services should be copiedjava.lang.InterruptedException - if the current thread is interrupted
while waitingCopyright © 2012 JBoss, a division of Red Hat, Inc.