camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/8] camel git commit: CAMEL-9015: JMX Agent should always let JVM system properties take precedence. Also aling that all the options is configured on the agent and not a mix of strategty/agent.
Date Sun, 26 Jul 2015 11:36:15 GMT
CAMEL-9015: JMX Agent should always let JVM system properties take precedence. Also aling that
all the options is configured on the agent and not a mix of strategty/agent.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/773d8cb8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/773d8cb8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/773d8cb8

Branch: refs/heads/master
Commit: 773d8cb8d864a099e1696f21f542e86368cf70a1
Parents: 9b047c8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Jul 26 10:30:22 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jul 26 13:34:12 2015 +0200

----------------------------------------------------------------------
 .../xml/AbstractCamelContextFactoryBean.java    | 75 ++++++++++++--------
 .../camel/core/xml/CamelJMXAgentDefinition.java | 19 +----
 2 files changed, 46 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/773d8cb8/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index b68173f..3f10f56 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -422,18 +422,51 @@ public abstract class AbstractCamelContextFactoryBean<T extends ModelCamelContex
         } else if (camelJMXAgent != null) {
             LOG.info("JMXAgent enabled: {}", camelJMXAgent);
             DefaultManagementAgent agent = new DefaultManagementAgent(getContext());
-            agent.setConnectorPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getConnectorPort()));
-            agent.setCreateConnector(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getCreateConnector()));
-            agent.setMBeanObjectDomainName(CamelContextHelper.parseText(getContext(), camelJMXAgent.getMbeanObjectDomainName()));
-            agent.setMBeanServerDefaultDomain(CamelContextHelper.parseText(getContext(),
camelJMXAgent.getMbeanServerDefaultDomain()));
-            agent.setRegistryPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getRegistryPort()));
-            agent.setServiceUrlPath(CamelContextHelper.parseText(getContext(), camelJMXAgent.getServiceUrlPath()));
-            agent.setUsePlatformMBeanServer(CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getUsePlatformMBeanServer()));
-            agent.setOnlyRegisterProcessorWithCustomId(CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getOnlyRegisterProcessorWithCustomId()));
-            agent.setRegisterAlways(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getRegisterAlways()));
-            agent.setRegisterNewRoutes(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getRegisterNewRoutes()));
-            agent.setIncludeHostName(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getIncludeHostName()));
-            agent.setMask(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getMask()));
+
+            if (camelJMXAgent.getConnectorPort() != null) {
+                agent.setConnectorPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getConnectorPort()));
+            }
+            if (camelJMXAgent.getCreateConnector() != null) {
+                agent.setCreateConnector(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getCreateConnector()));
+            }
+            if (camelJMXAgent.getMbeanObjectDomainName() != null) {
+                agent.setMBeanObjectDomainName(CamelContextHelper.parseText(getContext(),
camelJMXAgent.getMbeanObjectDomainName()));
+            }
+            if (camelJMXAgent.getMbeanServerDefaultDomain() != null) {
+                agent.setMBeanServerDefaultDomain(CamelContextHelper.parseText(getContext(),
camelJMXAgent.getMbeanServerDefaultDomain()));
+            }
+            if (camelJMXAgent.getRegistryPort() != null) {
+                agent.setRegistryPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getRegistryPort()));
+            }
+            if (camelJMXAgent.getServiceUrlPath() != null) {
+                agent.setServiceUrlPath(CamelContextHelper.parseText(getContext(), camelJMXAgent.getServiceUrlPath()));
+            }
+            if (camelJMXAgent.getUsePlatformMBeanServer() != null) {
+                agent.setUsePlatformMBeanServer(CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getUsePlatformMBeanServer()));
+            }
+            if (camelJMXAgent.getOnlyRegisterProcessorWithCustomId() != null) {
+                agent.setOnlyRegisterProcessorWithCustomId(CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getOnlyRegisterProcessorWithCustomId()));
+            }
+            if (camelJMXAgent.getRegisterAlways() != null) {
+                agent.setRegisterAlways(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getRegisterAlways()));
+            }
+            if (camelJMXAgent.getRegisterNewRoutes() != null) {
+                agent.setRegisterNewRoutes(CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getRegisterNewRoutes()));
+            }
+            if (camelJMXAgent.getIncludeHostName() != null) {
+                agent.setIncludeHostName(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getIncludeHostName()));
+            }
+            if (camelJMXAgent.getMask() != null) {
+                agent.setMask(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getMask()));
+            }
+            if (camelJMXAgent.getLoadStatisticsEnabled() != null) {
+                agent.setMask(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getLoadStatisticsEnabled()));
+            }
+            if (camelJMXAgent.getStatisticsLevel() != null) {
+                String level = CamelContextHelper.parseText(getContext(), camelJMXAgent.getStatisticsLevel());
+                ManagementStatisticsLevel msLevel = getContext().getTypeConverter().mandatoryConvertTo(ManagementStatisticsLevel.class,
level);
+                agent.setStatisticsLevel(msLevel);
+            }
 
             ManagementStrategy managementStrategy = new ManagedManagementStrategy(getContext(),
agent);
             getContext().setManagementStrategy(managementStrategy);
@@ -441,24 +474,6 @@ public abstract class AbstractCamelContextFactoryBean<T extends ModelCamelContex
             // clear the existing lifecycle strategies define by the DefaultCamelContext
constructor
             getContext().getLifecycleStrategies().clear();
             getContext().addLifecycleStrategy(new DefaultManagementLifecycleStrategy(getContext()));
-
-            // set additional configuration from camelJMXAgent
-            boolean onlyId = agent.getOnlyRegisterProcessorWithCustomId() != null &&
agent.getOnlyRegisterProcessorWithCustomId();
-            getContext().getManagementStrategy().onlyManageProcessorWithCustomId(onlyId);
-
-            String level = CamelContextHelper.parseText(getContext(), camelJMXAgent.getStatisticsLevel());
-            ManagementStatisticsLevel msLevel = getContext().getTypeConverter().mandatoryConvertTo(ManagementStatisticsLevel.class,
level);
-            getContext().getManagementStrategy().setStatisticsLevel(msLevel);
-
-            Boolean loadStatisticsEnabled = CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getLoadStatisticsEnabled());
-            if (loadStatisticsEnabled != null) {
-                getContext().getManagementStrategy().setLoadStatisticsEnabled(loadStatisticsEnabled);
-            }
-
-            Boolean extendedStatisticsEnabled = CamelContextHelper.parseBoolean(getContext(),
camelJMXAgent.getExtendedStatisticsEnabled());
-            if (extendedStatisticsEnabled != null) {
-                getContext().getManagementStrategy().setExtendedStatisticsEnabled(extendedStatisticsEnabled);
-            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/773d8cb8/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
index 26e0b68..0ada40d 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
@@ -103,7 +103,7 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
      * Level of granularity for performance statistics enabled
      */
     @XmlAttribute
-    private String statisticsLevel = ManagementStatisticsLevel.All.name();
+    private String statisticsLevel = ManagementStatisticsLevel.Default.name();
 
     /**
      * A flag that indicates whether Load statistics is enabled
@@ -112,12 +112,6 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
     private String loadStatisticsEnabled;
 
     /**
-     * A flag that indicates whether extended statistics is enabled
-     */
-    @XmlAttribute
-    private String extendedStatisticsEnabled;
-
-    /**
      * A flag that indicates whether to include hostname in JMX MBean names.
      */
     @XmlAttribute
@@ -233,14 +227,6 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
         this.loadStatisticsEnabled = loadStatisticsEnabled;
     }
 
-    public String getExtendedStatisticsEnabled() {
-        return extendedStatisticsEnabled;
-    }
-
-    public void setExtendedStatisticsEnabled(String extendedStatisticsEnabled) {
-        this.extendedStatisticsEnabled = extendedStatisticsEnabled;
-    }
-
     public String getIncludeHostName() {
         return includeHostName;
     }
@@ -286,9 +272,6 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
         if (loadStatisticsEnabled != null) {
             sb.append(", loadStatisticsEnabled=").append(loadStatisticsEnabled);
         }
-        if (extendedStatisticsEnabled != null) {
-            sb.append(", extendedStatisticsEnabled=").append(extendedStatisticsEnabled);
-        }
         if (onlyRegisterProcessorWithCustomId != null) {
             sb.append(", onlyRegisterProcessorWithCustomId=").append(onlyRegisterProcessorWithCustomId);
         }


Mime
View raw message