Repository: mesos
Updated Branches:
  refs/heads/master 9b78b3014 -> 7e631d612


Fixed flaky ExamplesTest.JavaLog.

Review: https://reviews.apache.org/r/37414


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/554bd8d9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/554bd8d9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/554bd8d9

Branch: refs/heads/master
Commit: 554bd8d96e3d006f528b149adadff96554dc644e
Parents: 9b78b30
Author: Greg Mann <[email protected]>
Authored: Sun Aug 16 19:13:26 2015 +0200
Committer: Till Toenshoff <[email protected]>
Committed: Sun Aug 16 19:13:27 2015 +0200

----------------------------------------------------------------------
 src/examples/java/TestLog.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/554bd8d9/src/examples/java/TestLog.java
----------------------------------------------------------------------
diff --git a/src/examples/java/TestLog.java b/src/examples/java/TestLog.java
index 9dd4630..8fa8158 100644
--- a/src/examples/java/TestLog.java
+++ b/src/examples/java/TestLog.java
@@ -108,10 +108,20 @@ public class TestLog {
     return p.exitValue();
   }
 
-  private static void exit(int status) {
+  private static void exit(int status) throws Exception {
     if (zkserver != null) {
       zkserver.stop();
     }
+    // For this test to pass reliably on some platforms, this sleep is
+    // required to ensure that the test server shutdown is complete
+    // before the JVM starts running native object destructors after
+    // System.exit() is called. 500ms proved successful in test runs,
+    // but on a heavily-loaded machine it might not.
+    // TODO(greg): Ideally, we would inspect the status of the server
+    // via the Java API and wait until its teardown is complete to
+    // exit.
+    Thread.sleep(500);
+
     System.exit(status);
   }
 

Reply via email to