geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject geode git commit: GEODE-2386 Don't call System.setProperties(null) when rule is used twice
Date Fri, 03 Feb 2017 18:26:34 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 2ac69f905 -> 3a12d6119


GEODE-2386 Don't call System.setProperties(null) when rule is used twice

Fixing DistributedRestoreSystemProperties rule so that if the rule is
included twice within a test, it does not end up calling
System.setProperties(null). That will prevent us from losing the value
of java.class.path set by gradle.

Reverting the workaround that didn't actually work.


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

Branch: refs/heads/develop
Commit: 3a12d61197877b55b882ebb69caf760b699c785b
Parents: 2ac69f9
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Thu Feb 2 13:34:13 2017 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Fri Feb 3 10:22:29 2017 -0800

----------------------------------------------------------------------
 .../DistributedRestoreSystemProperties.java     | 12 ++++++++----
 .../test/dunit/standalone/ProcessManager.java   | 20 +-------------------
 2 files changed, 9 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/3a12d611/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
index 7e6198e..322d0c6 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
@@ -49,8 +49,10 @@ public class DistributedRestoreSystemProperties extends RestoreSystemProperties
     this.invoker.invokeInEveryVM(new SerializableRunnable() {
       @Override
       public void run() {
-        originalProperties = getProperties();
-        setProperties(new Properties(originalProperties));
+        if (originalProperties == null) {
+          originalProperties = getProperties();
+          setProperties(new Properties(originalProperties));
+        }
       }
     });
   }
@@ -61,8 +63,10 @@ public class DistributedRestoreSystemProperties extends RestoreSystemProperties
     this.invoker.invokeInEveryVM(new SerializableRunnable() {
       @Override
       public void run() {
-        setProperties(originalProperties);
-        originalProperties = null;
+        if (originalProperties != null) {
+          setProperties(originalProperties);
+          originalProperties = null;
+        }
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/3a12d611/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 3b02b4b..d7b15fc 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,8 +16,6 @@ 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;
@@ -34,7 +32,6 @@ 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;
 
@@ -174,7 +171,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 = getClasspath();
+    String dunitClasspath = System.getProperty("java.class.path");
     String classPath;
     if (!VersionManager.isCurrentVersion(version)) {
       classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
@@ -236,21 +233,6 @@ 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