org.mortbay.util
Class Container

java.lang.Object
  extended byorg.mortbay.util.Container
All Implemented Interfaces:
EventProvider, LifeCycle, java.io.Serializable
Direct Known Subclasses:
HttpContext, HttpServer, ServletHandler

public abstract class Container
extends java.lang.Object
implements LifeCycle, EventProvider, java.io.Serializable

Abstract Container. Provides base handling for LifeCycle and Component events.

Version:
$Id: Container.java,v 1.4 2005/08/13 08:49:59 gregwilkins Exp $
Author:
Greg Wilkins (gregw)
See Also:
Serialized Form

Constructor Summary
Container()
           
 
Method Summary
 void addEventListener(java.util.EventListener listener)
          Add a server event listener.
 void destroy()
          Destroy a stopped server.
 java.util.Collection getComponents()
           
 boolean isStarted()
           
 void removeEventListener(java.util.EventListener listener)
           
 void start()
          Start the server.
 void stop()
          Stop the container.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Container

public Container()
Method Detail

start

public final void start()
                 throws java.lang.Exception
Start the server. Generate LifeCycleEvents for starting and started either side of a call to doStart

Specified by:
start in interface LifeCycle
Throws:
java.lang.Exception - An arbitrary exception may be thrown.

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle
Returns:
True if the LifeCycle has been started.

stop

public final void stop()
                throws java.lang.InterruptedException
Stop the container. Generate LifeCycleEvents for stopping and stopped either side of a call to doStop

Specified by:
stop in interface LifeCycle
Throws:
java.lang.InterruptedException - Stopping a lifecycle is rarely atomic and may be interrupted by another thread. If this happens InterruptedException is throw and the component will be in an indeterminant state and should probably be discarded.

addEventListener

public void addEventListener(java.util.EventListener listener)
                      throws java.lang.IllegalArgumentException
Add a server event listener.

Specified by:
addEventListener in interface EventProvider
Parameters:
listener - ComponentEventListener or LifeCycleEventListener
Throws:
java.lang.IllegalArgumentException - If the EventListener type is not supported.

removeEventListener

public void removeEventListener(java.util.EventListener listener)
Specified by:
removeEventListener in interface EventProvider

destroy

public void destroy()
Destroy a stopped server. Remove all components and send notifications to all event listeners. The HttpServer must be stopped before it can be destroyed.


getComponents

public java.util.Collection getComponents()


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.