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

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 4d46a59  Deal with jvm process leak in TestUtils (#2454)
4d46a59 is described below

commit 4d46a59cdfc67352df8ef6ab690063aecf97dc14
Author: Dominic Kim <[email protected]>
AuthorDate: Wed Jul 12 14:53:42 2017 +0900

    Deal with jvm process leak in TestUtils (#2454)
---
 tests/src/test/scala/common/TestUtils.java | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/tests/src/test/scala/common/TestUtils.java 
b/tests/src/test/scala/common/TestUtils.java
index 6ead81f..f2ceda0 100644
--- a/tests/src/test/scala/common/TestUtils.java
+++ b/tests/src/test/scala/common/TestUtils.java
@@ -17,6 +17,7 @@
 
 package common;
 
+import static common.TestUtils.RunResult.executor;
 import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
@@ -30,7 +31,6 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -206,6 +206,8 @@ public class TestUtils {
      *   stderr the messages printed to standard error
      */
     public static class RunResult {
+        public static final ExecutorService executor = 
Executors.newFixedThreadPool(2);
+
         public final int exitCode;
         public final String stdout;
         public final String stderr;
@@ -292,19 +294,9 @@ public class TestUtils {
         }
         Process p = pb.start();
 
-        ExecutorService executor = Executors.newFixedThreadPool(2);
-
-        Future<String> stdoutFuture = executor.submit(new Callable<String>() {
-            public String call() throws IOException {
-                return inputStreamToString(p.getInputStream());
-            }
-        });
+        Future<String> stdoutFuture = executor.submit(() -> 
inputStreamToString(p.getInputStream()));
 
-        Future<String> stderrFuture = executor.submit(new Callable<String>() {
-            public String call() throws IOException {
-                return inputStreamToString(p.getErrorStream());
-            }
-        });
+        Future<String> stderrFuture = executor.submit(() -> 
inputStreamToString(p.getErrorStream()));
 
         String stdout = "";
         String stderr = "";

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to