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 kr...@apache.org on 2012/02/21 08:38:44 UTC

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

Author: kristwaa
Date: Tue Feb 21 07:38:43 2012
New Revision: 1291631

URL: http://svn.apache.org/viewvc?rev=1291631&view=rev
Log:
DERBY-5617: Improve process handling in SpawnedProcess

Fix incorrect ordering of process cleanup and waiting for the output drainer
threads to terminate. Closing the process streams prematurely is wrong, and
truncated output was observed on a presumably slower/single-core machine.
Fixed a few typos in comments/messages.

Patch file: derby-5617-2a-join_destroy_ordering.diff

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SpawnedProcess.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SpawnedProcess.java?rev=1291631&r1=1291630&r2=1291631&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SpawnedProcess.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SpawnedProcess.java Tue Feb 21 07:38:43 2012
@@ -99,7 +99,7 @@ public final class SpawnedProcess {
             // terminates before returning, and we don't want to preserve
             // the interrupt flag because it causes Derby to shut down. These
             // are test requirements and don't apply for production code.
-            // Print a notice to stderr.
+            // Print a notice to stdout.
             System.out.println(TAG + "Interrupted while sleeping (ignored)");
         }
     }
@@ -311,9 +311,9 @@ public final class SpawnedProcess {
 
         // Clean up
         killTask.cancel();
-        cleanupProcess();
         joinWith(errSaver.thread);
         joinWith(outSaver.thread);
+        cleanupProcess();
         printDiagnostics(exitCode.intValue());
         return exitCode.intValue();
     }
@@ -367,7 +367,7 @@ public final class SpawnedProcess {
             // terminates before returning, and we don't want to preserve
             // the interrupt flag because it causes Derby to shut down. These
             // are test requirements and don't apply for production code.
-            // Print a notice to stderr.
+            // Print a notice to stdout.
             System.out.println(TAG + "Interrupted while joining " +
                     "with thread '" + t.toString() + "'");
         }
@@ -497,7 +497,7 @@ public final class SpawnedProcess {
             }
             if (retriesAllowed == 0) {
                 System.err.println(
-                        "DEBUG: Faild to destroy process '" + name + "'");
+                        "DEBUG: Failed to destroy process '" + name + "'");
             } 
             process = null;
         }