db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r639433 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Date Thu, 20 Mar 2008 19:58:37 GMT
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;
+            }
+                
         }
     }
     



Mime
View raw message