You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2018/11/21 20:02:15 UTC

[geode-benchmarks] branch develop updated: Making ChildJVMs exit gracefully

This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8699d66  Making ChildJVMs exit gracefully
8699d66 is described below

commit 8699d663dc533f632baa992f4f3532db29998dfc
Author: Dan Smith <up...@apache.org>
AuthorDate: Wed Nov 21 11:58:37 2018 -0800

    Making ChildJVMs exit gracefully
    
    Eliminating warnings in the logs due to ChildJVMs being terminated
---
 .../java/org/apache/geode/perftest/jvms/RemoteJVMs.java  |  2 +-
 .../org/apache/geode/perftest/jvms/rmi/ChildJVM.java     | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/harness/src/main/java/org/apache/geode/perftest/jvms/RemoteJVMs.java b/harness/src/main/java/org/apache/geode/perftest/jvms/RemoteJVMs.java
index aa1e546..368cc89 100644
--- a/harness/src/main/java/org/apache/geode/perftest/jvms/RemoteJVMs.java
+++ b/harness/src/main/java/org/apache/geode/perftest/jvms/RemoteJVMs.java
@@ -67,9 +67,9 @@ public class RemoteJVMs implements AutoCloseable {
   }
 
   public void close() throws IOException, ExecutionException, InterruptedException {
-    infra.close();
     controller.close();
     exited.get();
+    infra.close();
   }
 
   /**
diff --git a/harness/src/main/java/org/apache/geode/perftest/jvms/rmi/ChildJVM.java b/harness/src/main/java/org/apache/geode/perftest/jvms/rmi/ChildJVM.java
index 45d4c6a..ffa08ed 100644
--- a/harness/src/main/java/org/apache/geode/perftest/jvms/rmi/ChildJVM.java
+++ b/harness/src/main/java/org/apache/geode/perftest/jvms/rmi/ChildJVM.java
@@ -19,6 +19,7 @@ package org.apache.geode.perftest.jvms.rmi;
 
 import java.io.File;
 import java.io.PrintStream;
+import java.rmi.RemoteException;
 
 import org.apache.commons.io.FileUtils;
 import org.bouncycastle.jcajce.provider.drbg.DRBG;
@@ -56,9 +57,9 @@ public class ChildJVM {
       String OUTPUT_DIR = system.getProperty(RemoteJVMFactory.OUTPUT_DIR);
       int id = system.getInteger(RemoteJVMFactory.JVM_ID);
 
-
-      if(RMI_HOST == null || RMI_PORT == null || OUTPUT_DIR == null) {
-        throw new IllegalStateException("ChildJVM must be launched with all required system properties set.");
+      if (RMI_HOST == null || RMI_PORT == null || OUTPUT_DIR == null) {
+        throw new IllegalStateException(
+            "ChildJVM must be launched with all required system properties set.");
       }
 
       File outputDir = new File(OUTPUT_DIR);
@@ -81,8 +82,13 @@ public class ChildJVM {
 
       //Wait until the controller shuts down
       //If the controller shuts down, this will throw an exception
-      while (controller.ping()) {
-        Thread.sleep(pingTime);
+      try {
+        while (controller.ping()) {
+          Thread.sleep(pingTime);
+        }
+      } catch(RemoteException e) {
+        //If we get a RemoteException, the controller has shut down
+        //exit gracefully
       }
 
       system.exit(0);