You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2008/03/20 20:58:37 UTC

svn commit: r639433 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Author: djd
Date: Thu Mar 20 12:58:36 2008
New Revision: 639433

URL: http://svn.apache.org/viewvc?rev=639433&view=rev
Log:
DERBY-3544 If the network server fails to shutdown in NetworkServerTestSetup.teardown() then destory the process if it was run as a spearate jvm. Otherwise a chance of a hang existed when the executing the wait for on the process object.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=639433&r1=639432&r2=639433&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Thu Mar 20 12:58:36 2008
@@ -369,13 +369,14 @@
             } catch (Exception e) {
             }
       
+            Throwable failedShutdown = null;
             if (running)
             {
                 try {
                     networkServerController.shutdown();
                 } catch (Throwable t)
                 {
-                    t.printStackTrace( System.out );
+                    failedShutdown = t;
                 }
             }
  
@@ -384,9 +385,23 @@
             serverOutput = null;
 
             if (spawnedServer != null) {
-                spawnedServer.complete(false);
+                // Destroy the process if a failed shutdown
+                // to avoid hangs running tests as the complete()
+                // waits for the process to complete.
+                spawnedServer.complete(failedShutdown != null);
                 spawnedServer = null;
             }
+            
+            // Throw an error to record the fact that the
+            // shutdown failed.
+            if (failedShutdown != null)
+            {
+                if (failedShutdown instanceof Exception)
+                    throw (Exception) failedShutdown;
+                
+                throw (Error) failedShutdown;
+            }
+                
         }
     }