diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-08-01 14:58:48 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-08-01 14:58:48 +0200 |
commit | 2e7201c5a9b533b66e9b5d396810af7bade60a4e (patch) | |
tree | 88778bfba3329a5ed212834d139d45ffb2fdd237 /server/sonar-process | |
parent | 1e22a5cfa8a4b13c795db11e8ab5b88d24071209 (diff) | |
download | sonarqube-2e7201c5a9b533b66e9b5d396810af7bade60a4e.tar.gz sonarqube-2e7201c5a9b533b66e9b5d396810af7bade60a4e.zip |
SONAR-4898 experimental test for fixing RMI IP address
Diffstat (limited to 'server/sonar-process')
-rw-r--r-- | server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java index 61174036315..9033640937e 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java @@ -40,8 +40,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -218,7 +216,7 @@ public class ProcessWrapper extends Thread implements Terminable { "-Dcom.sun.management.jmxremote.port=" + jmxPort, "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", - "-Djava.rmi.server.hostname=" + loopbackAddress()); + "-Djava.rmi.server.hostname=" + localAddress()); } private List<String> buildClasspath() { @@ -245,7 +243,7 @@ public class ProcessWrapper extends Thread implements Terminable { */ @CheckForNull private ProcessMXBean waitForJMX() throws Exception { - String loopbackAddress = loopbackAddress(); + String loopbackAddress = localAddress(); String path = "/jndi/rmi://" + loopbackAddress + ":" + jmxPort + "/jmxrmi"; JMXServiceURL jmxUrl = new JMXServiceURL("rmi", loopbackAddress, jmxPort, path); @@ -265,11 +263,8 @@ public class ProcessWrapper extends Thread implements Terminable { return null; } - /** - * Should be replaced by InetAddress#getLoopbackAddress() in Java 7 - */ - private String loopbackAddress() throws UnknownHostException { - return InetAddress.getLocalHost().getHostAddress(); + private String localAddress() { + return "127.0.0.1"; } @Override |