camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r814607 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/management: DefaultManagementLifecycleStrategy.java ManagedManagementStrategy.java
Date Mon, 14 Sep 2009 12:23:13 GMT
Author: davsclaus
Date: Mon Sep 14 12:23:12 2009
New Revision: 814607

URL: http://svn.apache.org/viewvc?rev=814607&view=rev
Log:
CAMEL-2012: Only manage singleton endpoints to avoid overhead of non singletons.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=814607&r1=814606&r2=814607&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
Mon Sep 14 12:23:12 2009
@@ -171,8 +171,12 @@
         }
 
         try {
-            Object me = getManagedObjectForEndpoint(endpoint);
-            getManagementStrategy().manageObject(me);
+            Object managedObject = getManagedObjectForEndpoint(endpoint);
+            if (managedObject == null) {
+                // endpoint should not be managed
+                return;
+            }
+            getManagementStrategy().manageObject(managedObject);
         } catch (Exception e) {
             LOG.warn("Could not register Endpoint MBean for uri: " + endpoint.getEndpointUri(),
e);
         }
@@ -194,6 +198,11 @@
 
     @SuppressWarnings("unchecked")
     private Object getManagedObjectForEndpoint(Endpoint endpoint) {
+        // we only want to manage singleton endpoints
+        if (!endpoint.isSingleton()) {
+            return null;
+        }
+
         if (endpoint instanceof ManagementAware) {
             return ((ManagementAware) endpoint).getManagedObject(endpoint);
         } else if (endpoint instanceof BrowsableEndpoint) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java?rev=814607&r1=814606&r2=814607&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
Mon Sep 14 12:23:12 2009
@@ -70,6 +70,10 @@
     }
 
     public <T> T getManagedObjectName(Object managedObject, String customName, Class<T>
nameType) throws Exception {
+        if (managedObject == null) {
+            return null;
+        }
+
         ObjectName objectName = null;
 
         if (managedObject instanceof ManagedCamelContext) {



Mime
View raw message