org.codehaus.cargo.container.spi.util
Class DefaultServerRun

java.lang.Object
  extended by java.lang.Thread
      extended by org.codehaus.cargo.container.spi.util.DefaultServerRun
All Implemented Interfaces:
java.lang.Runnable

public class DefaultServerRun
extends java.lang.Thread

Helper class to start/stop a container. When this application is first called to start the server, a listener socket is set up. Then, we it is later called to stop the server, we connect to the listener socket and tell the server to stop.

Version:
$Id: DefaultServerRun.java 1037 2006-05-26 08:26:38Z vmassol $

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DefaultServerRun(java.lang.String[] theArgs)
           
 
Method Summary
protected  void doRun()
          Parse and process the command line to start/stop the server.
protected  void doStartServer(java.lang.String[] theArgs)
          Starts the server (in a blocking mode) and set up a socket listener.
protected  void doStopServer(java.lang.String[] theArgs)
          Stops the server by connecting to the socket set up when the server was started.
 void run()
          Sets up a listener socket and wait until we receive a request on it to stop the running server.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultServerRun

public DefaultServerRun(java.lang.String[] theArgs)
Parameters:
theArgs - the command line arguments
Method Detail

doStartServer

protected void doStartServer(java.lang.String[] theArgs)
                      throws java.lang.Exception
Starts the server (in a blocking mode) and set up a socket listener.

Parameters:
theArgs - the command line arguments
Throws:
java.lang.Exception - if any error happens when starting the server

doStopServer

protected void doStopServer(java.lang.String[] theArgs)
                     throws java.lang.Exception
Stops the server by connecting to the socket set up when the server was started.

Parameters:
theArgs - the command line arguments
Throws:
java.lang.Exception - if any error happens when stopping the server

doRun

protected final void doRun()
Parse and process the command line to start/stop the server.


run

public void run()
Sets up a listener socket and wait until we receive a request on it to stop the running server.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread


Copyright © 2004-2011 Codehaus. All Rights Reserved.