JBoss Modular Service Kernel API 1.0.0.CR2

org.jboss.msc.service
Interface ServiceContainer

All Superinterfaces:
ServiceRegistry, ServiceTarget
All Known Implementing Classes:
DelegatingServiceContainer

public interface ServiceContainer
extends ServiceTarget, ServiceRegistry

A service container which manages a set of running services.

Author:
David M. Lloyd

Nested Class Summary
static class ServiceContainer.Factory
          The factory class for service containers.
static interface ServiceContainer.TerminateListener
          A listener for notification of container shutdown.
 
Method Summary
 void addTerminateListener(ServiceContainer.TerminateListener listener)
          Add a terminate listener to this container.
 void awaitTermination()
          Causes the current thread to wait until the container is shutdown.
 void awaitTermination(long timeout, TimeUnit unit)
          Causes the current thread to wait until the container is shutdown.
 void dumpServices()
          Dump a complete list of services to System.out.
 void dumpServices(PrintStream stream)
          Dump a complete list of services to the given stream.
 String getName()
          Get the name of this service container.
 boolean isShutdownComplete()
          Determine whether the container is completely shut down.
 void shutdown()
          Stop all services within this container.
 
Methods inherited from interface org.jboss.msc.service.ServiceTarget
addDependency, addDependency, addDependency, addListener, addListener, addListener, addListener, addListener, addListener, addService, addServiceValue, batchTarget, getDependencies, getListeners, removeDependency, removeListener, subTarget
 
Methods inherited from interface org.jboss.msc.service.ServiceRegistry
getRequiredService, getService, getServiceNames
 

Method Detail

shutdown

void shutdown()
Stop all services within this container.


isShutdownComplete

boolean isShutdownComplete()
Determine whether the container is completely shut down.

Returns:
true if shutdown is complete

addTerminateListener

void addTerminateListener(ServiceContainer.TerminateListener listener)
Add a terminate listener to this container. The added listener will be invoked when this container shutdown process is complete.

Parameters:
listener - the listener

awaitTermination

void awaitTermination()
                      throws InterruptedException
Causes the current thread to wait until the container is shutdown.

Throws:
InterruptedException - if the current thread is interrupted while waiting

awaitTermination

void awaitTermination(long timeout,
                      TimeUnit unit)
                      throws InterruptedException
Causes the current thread to wait until the container is shutdown.

Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Throws:
InterruptedException - if the current thread is interrupted while waiting

dumpServices

void dumpServices()
Dump a complete list of services to System.out.


dumpServices

void dumpServices(PrintStream stream)
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

JBoss Modular Service Kernel API 1.0.0.CR2

Copyright © 2011 JBoss, a division of Red Hat, Inc.