You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2004/04/18 14:21:50 UTC
cvs commit: jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container AbstractServerRun.java
vmassol 2004/04/18 05:21:50
Modified: integration/ant/src/java/org/apache/cactus/integration/ant/container/resin
ResinRun.java
integration/ant/src/java/org/apache/cactus/integration/ant/container/enhydra
EnhydraRun.java
integration/ant/src/java/org/apache/cactus/integration/ant/container
AbstractServerRun.java
Log:
Resin 3.x was not stopping correctly. The wrong thread was stopped.
Revision Changes Path
1.8 +12 -4 jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/resin/ResinRun.java
Index: ResinRun.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/resin/ResinRun.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ResinRun.java 29 Feb 2004 10:10:42 -0000 1.7
+++ ResinRun.java 18 Apr 2004 12:21:50 -0000 1.8
@@ -67,8 +67,10 @@
*
* @see AbstractServerRun#doStartServer
*/
- protected final void doStartServer(String[] theArgs)
+ protected final Thread doStartServer(String[] theArgs)
{
+ Thread runningThread = this;
+
try
{
if (isResinVersion("2.0"))
@@ -81,7 +83,7 @@
}
else if (isResinVersion("3"))
{
- startResin3x(theArgs);
+ runningThread = startResin3x(theArgs);
}
else
{
@@ -94,6 +96,8 @@
e.printStackTrace();
throw new RuntimeException("Failed to start Resin server");
}
+
+ return runningThread;
}
/**
@@ -143,10 +147,11 @@
/**
* Starts Resin 3.x
*
+ * @return the thread in which the server has been started
* @param theArgs the command line arguments for starting the server
* @throws Exception if an error happens when starting the server
*/
- private void startResin3x(final String[] theArgs) throws Exception
+ private Thread startResin3x(final String[] theArgs) throws Exception
{
// Start the server in another thread so that it doesn't block
// the current thread. It seems that Resin 3.x is acting differently
@@ -168,6 +173,7 @@
}
catch (Exception e)
{
+ e.printStackTrace();
throw new RuntimeException(
"Failed to start Resin 3.x. Error = ["
+ e.getMessage() + "]");
@@ -175,6 +181,8 @@
}
};
startThread.start();
+
+ return startThread;
}
/**
1.8 +4 -2 jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/enhydra/EnhydraRun.java
Index: EnhydraRun.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/enhydra/EnhydraRun.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EnhydraRun.java 29 Feb 2004 10:10:41 -0000 1.7
+++ EnhydraRun.java 18 Apr 2004 12:21:50 -0000 1.8
@@ -57,7 +57,7 @@
*
* @see AbstractServerRun#doStartServer
*/
- protected final void doStartServer(String[] theArgs)
+ protected final Thread doStartServer(String[] theArgs)
{
try
{
@@ -73,6 +73,8 @@
e.printStackTrace();
throw new RuntimeException("Cannot create instance of MultiServer");
}
+
+ return this;
}
/**
1.7 +7 -6 jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractServerRun.java
Index: AbstractServerRun.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractServerRun.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractServerRun.java 29 Feb 2004 10:05:26 -0000 1.6
+++ AbstractServerRun.java 18 Apr 2004 12:21:50 -0000 1.7
@@ -72,10 +72,11 @@
/**
* Starts the server (in a blocking mode) and set up a socket listener.
*
+ * @return the thread in which the server has been started
* @param theArgs the command line arguments
* @exception Exception if any error happens when starting the server
*/
- protected abstract void doStartServer(String[] theArgs) throws Exception;
+ protected abstract Thread doStartServer(String[] theArgs) throws Exception;
/**
* Stops the server by connecting to the socket set up when the server
@@ -149,7 +150,7 @@
try
{
- doStartServer(this.args);
+ this.runningServerThread = doStartServer(this.args);
}
catch (Exception e)
{
@@ -159,9 +160,9 @@
// Server is now started
this.isStarted = true;
-
- this.runningServerThread = new Thread(this);
- this.runningServerThread.start();
+
+ // Start a socket listener that will listen for stop commands.
+ start();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org