org.apache.cactus.integration.ant.container
Class ContainerRunner

java.lang.Object
  extended byorg.apache.cactus.integration.ant.container.ContainerRunner

public final class ContainerRunner
extends java.lang.Object

Support class that handles the lifecycle of a container, which basically consists of startup and shutdown.

Version:
$Id: ContainerRunner.java,v 1.4 2003/07/09 14:22:41 cmlenz Exp $
Author:
Christopher Lenz

Constructor Summary
ContainerRunner(Container theContainer)
          Constructor.
 
Method Summary
 java.lang.String getServerName()
          Returns the server name as reported in the 'Server' header of HTTP responses from the server.
 void setCheckInterval(long theCheckInterval)
          Sets the time interval to sleep between polling the container.
 void setLog(org.apache.commons.logging.Log theLog)
          Sets the log to write to.
 void setShutDownWait(long theShutDownWait)
          Sets the time to wait after the container has been shut down.
 void setStartUpWait(long theStartUpWait)
          Sets the time to wait after the container has been started up.
 void setTimeout(long theTimeout)
          Sets the timeout after which to stop trying to call the container.
 void setUrl(java.net.URL theUrl)
          Sets the HTTP URL that will be continuously pinged to check if the container is running.
 void shutDownContainer()
          Method called by the task to perform the stopping of the container.
 void startUpContainer()
          Method called by the task to perform the startup of the container.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainerRunner

public ContainerRunner(Container theContainer)
Constructor.

Parameters:
theContainer - The container to run
Method Detail

getServerName

public java.lang.String getServerName()
Returns the server name as reported in the 'Server' header of HTTP responses from the server.

Returns:
The server name

startUpContainer

public void startUpContainer()
                      throws java.lang.IllegalStateException
Method called by the task to perform the startup of the container. This method takes care of starting the container in another thread, and polling the test URL to check whether startup has completed. As soon as the URL is available (or the timeout is exceeded), control is returned to the caller.

Throws:
java.lang.IllegalStateException - If the 'url' property is null

shutDownContainer

public void shutDownContainer()
                       throws java.lang.IllegalStateException
Method called by the task to perform the stopping of the container. This method takes care of stopping the container in another thread, and polling the test URL to check whether shutdown has completed. As soon as the URL stops responding, control is returned to the caller.

Throws:
java.lang.IllegalStateException - If the 'url' property is null

setCheckInterval

public void setCheckInterval(long theCheckInterval)
Sets the time interval to sleep between polling the container. The default interval is 500 milliseconds.

Parameters:
theCheckInterval - The interval in milliseconds

setLog

public void setLog(org.apache.commons.logging.Log theLog)
Sets the log to write to.

Parameters:
theLog - The log to set

setShutDownWait

public void setShutDownWait(long theShutDownWait)
Sets the time to wait after the container has been shut down. The default time is 2 seconds.

Parameters:
theShutDownWait - The time to wait in milliseconds

setStartUpWait

public void setStartUpWait(long theStartUpWait)
Sets the time to wait after the container has been started up. The default time is 1 second.

Parameters:
theStartUpWait - The time to wait in milliseconds

setTimeout

public void setTimeout(long theTimeout)
Sets the timeout after which to stop trying to call the container. The default timeout is 3 minutes.

Parameters:
theTimeout - The timeout in milliseconds

setUrl

public void setUrl(java.net.URL theUrl)
Sets the HTTP URL that will be continuously pinged to check if the container is running.

Parameters:
theUrl - The URL to set


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.