brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject git commit: Get mapped port for JMXRMI as well as JMXMP
Date Fri, 30 May 2014 17:15:11 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 33bb6ce81 -> cc0830936


Get mapped port for JMXRMI as well as JMXMP


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/cc083093
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/cc083093
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/cc083093

Branch: refs/heads/master
Commit: cc0830936a71c38abf07a540826e3c64a1d353a6
Parents: 33bb6ce
Author: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Fri May 30 18:14:10 2014 +0100
Committer: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Fri May 30 18:14:10 2014 +0100

----------------------------------------------------------------------
 .../main/java/brooklyn/entity/java/JmxSupport.java | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc083093/software/base/src/main/java/brooklyn/entity/java/JmxSupport.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/java/JmxSupport.java b/software/base/src/main/java/brooklyn/entity/java/JmxSupport.java
index d700800..70feab6 100644
--- a/software/base/src/main/java/brooklyn/entity/java/JmxSupport.java
+++ b/software/base/src/main/java/brooklyn/entity/java/JmxSupport.java
@@ -2,6 +2,7 @@ package brooklyn.entity.java;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.annotation.Nonnull;
@@ -148,19 +149,17 @@ public class JmxSupport implements UsesJmx {
             host = machine.getAddress().getHostName();
         }
         
-        if (getJmxAgentMode()==JmxAgentModes.JMXMP || getJmxAgentMode()==JmxAgentModes.JMXMP_AND_RMI)
{
-            // only JMXMP is valid for going through firewalls (it is the default)
-            HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(entity, entity.getAttribute(JMX_PORT));
-            return JmxHelper.toJmxmpUrl(hp.getHostText(), hp.getPort());
+        if (EnumSet.of(JmxAgentModes.JMXMP, JmxAgentModes.JMXMP_AND_RMI).contains(getJmxAgentMode()))
{
+            HostAndPort jmxmp = BrooklynAccessUtils.getBrooklynAccessibleAddress(entity,
entity.getAttribute(JMX_PORT));
+            return JmxHelper.toJmxmpUrl(jmxmp.getHostText(), jmxmp.getPort());
         } else {
-            if (getJmxAgentMode()==JmxAgentModes.NONE) {
+            if (getJmxAgentMode() == JmxAgentModes.NONE) {
                 fixPortsForModeNone();
             }
             // this will work for agent or agentless
-            return JmxHelper.toRmiJmxUrl(host, 
-                    entity.getAttribute(JMX_PORT),
-                    entity.getAttribute(RMI_REGISTRY_PORT),
-                    entity.getAttribute(JMX_CONTEXT));
+            HostAndPort jmx = BrooklynAccessUtils.getBrooklynAccessibleAddress(entity, entity.getAttribute(JMX_PORT));
+            HostAndPort rmi = BrooklynAccessUtils.getBrooklynAccessibleAddress(entity, entity.getAttribute(RMI_REGISTRY_PORT));
+            return JmxHelper.toRmiJmxUrl(jmx.getHostText(), jmx.getPort(), rmi.getPort(),
entity.getAttribute(JMX_CONTEXT));
         }
     }
 


Mime
View raw message