Package org.jboss.msc.service
Interface ServiceContainer
- All Superinterfaces:
ServiceRegistry,ServiceTarget
- All Known Implementing Classes:
DelegatingServiceContainer
A service container which manages a set of running services.
- Author:
- David M. Lloyd, Richard Opalka
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe factory class for service containers.static interfaceA listener for notification of container shutdown. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a terminate listener to this container.voidCauses the current thread to wait until the container is stable.booleanawaitStability(long timeout, TimeUnit unit) Causes the current thread to wait until the container is stable.booleanawaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problem) Causes the current thread to wait until the container is stable.voidawaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problem) Causes the current thread to wait until the container is stable.voidCauses the current thread to wait until the container is shutdown.voidawaitTermination(long timeout, TimeUnit unit) Causes the current thread to wait until the container is shutdown.voidDump a complete list of services toSystem.out.voiddumpServices(PrintStream stream) Dump a complete list of services to the given stream.getName()Get the name of this service container.booleanWhether container have been shut down.booleanDetermine whether the container is completely shut down.voidshutdown()Stop all services within this container.Methods inherited from interface org.jboss.msc.service.ServiceRegistry
getRequiredService, getService, getServiceNamesMethods inherited from interface org.jboss.msc.service.ServiceTarget
addDependency, addListener, addMonitor, addService, addService, addService, removeListener, removeMonitor, subTarget
-
Method Details
-
shutdown
void shutdown()Stop all services within this container. -
isShutdown
boolean isShutdown()Whether container have been shut down.- Returns:
trueif container is shutting down
-
isShutdownComplete
boolean isShutdownComplete()Determine whether the container is completely shut down.- Returns:
trueif shutdown is complete
-
addTerminateListener
Add a terminate listener to this container. The addedlistenerwill be invoked when this container shutdown process is complete.- Parameters:
listener- the listener
-
awaitTermination
Causes the current thread to wait until the container is shutdown.- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitTermination
Causes the current thread to wait until the container is shutdown.- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitStability
Causes the current thread to wait until the container is stable.- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitStability
Causes the current thread to wait until the container is stable.- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- Returns:
- true if this container achieved stability, false if the timeout elapsed before stability
- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitStability
void awaitStability(Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problem) throws InterruptedException Causes the current thread to wait until the container is stable.- Parameters:
failed- a set into which failed services should be copiedproblem- a set into which problem services should be copied- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
awaitStability
boolean awaitStability(long timeout, TimeUnit unit, Set<? super ServiceController<?>> failed, Set<? super ServiceController<?>> problem) throws InterruptedException Causes the current thread to wait until the container is stable.- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargumentfailed- a set into which failed services should be copiedproblem- a set into which problem services should be copied- Returns:
- true if this container achieved stability, false if the timeout elapsed before stability
- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
dumpServices
void dumpServices()Dump a complete list of services toSystem.out. -
dumpServices
Dump a complete list of services to the given stream.- Parameters:
stream- the stream to which the service list should be written
-
getName
String getName()Get the name of this service container.- Returns:
- the container name
-