geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [17/32] geode git commit: GEODE-2386: Wait until classpath doesn't contain gradle-worker.jar
Date Fri, 03 Feb 2017 18:35:46 GMT
GEODE-2386: Wait until classpath doesn't contain gradle-worker.jar

Workaround for an issue with gradle and dunit where gradle does not set
the java.class.path to the correct value immediately. Wait for at most
30 seconds until gradle "fixes" the value.

Review by: Hitesh


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/87cef789
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/87cef789
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/87cef789

Branch: refs/heads/feature/GEODE-1930-2
Commit: 87cef789cd430b1b2ac1e54d97639b24aa98f5fd
Parents: f73d288
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Wed Feb 1 13:42:50 2017 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Wed Feb 1 14:20:53 2017 -0800

----------------------------------------------------------------------
 .../test/dunit/standalone/ProcessManager.java   | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/87cef789/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
index d7b15fc..3b02b4b 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
@@ -16,6 +16,8 @@ package org.apache.geode.test.dunit.standalone;
 
 import static org.apache.geode.distributed.ConfigurationProperties.*;
 
+import com.jayway.awaitility.Awaitility;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -32,6 +34,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.io.FileUtils;
 
@@ -171,7 +174,7 @@ public class ProcessManager {
 
   private String[] buildJavaCommand(int vmNum, int namingPort, String version) {
     String cmd = System.getProperty("java.home") + File.separator + "bin" + File.separator
+ "java";
-    String dunitClasspath = System.getProperty("java.class.path");
+    String dunitClasspath = getClasspath();
     String classPath;
     if (!VersionManager.isCurrentVersion(version)) {
       classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
@@ -233,6 +236,21 @@ public class ProcessManager {
     return rst;
   }
 
+  private String getClasspath() {
+    String classpath = System.getProperty("java.class.path");
+    // Workaround for GEODE-2386
+    long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);
+    while (classpath.contains("gradle-worker.jar") && System.nanoTime() < endTime)
{
+      try {
+        Thread.sleep(100);
+      } catch (InterruptedException e) {
+        // do nothing
+      }
+      classpath = System.getProperty("java.class.path");
+    }
+    return classpath;
+  }
+
   private String removeJREJars(String classpath) {
     String[] jars = classpath.split(File.pathSeparator);
     StringBuilder sb = new StringBuilder(classpath.length());


Mime
View raw message