cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject git commit: [CXF-5959]support to specify instance.id of ManagedBus (cherry picked from commit 70caefd28763f23b319aead8cefdcdc1b9fe8927)
Date Mon, 18 Aug 2014 07:54:00 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes bddbffead -> fb9a71990


[CXF-5959]support to specify instance.id of ManagedBus
(cherry picked from commit 70caefd28763f23b319aead8cefdcdc1b9fe8927)


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

Branch: refs/heads/2.7.x-fixes
Commit: fb9a71990eaec3f717f10104259ff4693df1c6af
Parents: bddbffe
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Mon Aug 18 15:50:12 2014 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Mon Aug 18 15:51:56 2014 +0800

----------------------------------------------------------------------
 rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/fb9a7199/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
----------------------------------------------------------------------
diff --git a/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java b/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
index 3dad976..4371fb1 100644
--- a/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
+++ b/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
@@ -23,6 +23,7 @@ import javax.management.JMException;
 import javax.management.ObjectName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.management.ManagedComponent;
 import org.apache.cxf.management.ManagementConstants;
 import org.apache.cxf.management.annotation.ManagedOperation;
@@ -33,6 +34,7 @@ import org.apache.cxf.management.annotation.ManagedResource;
                  
 public class ManagedBus implements ManagedComponent {
     private static final String TYPE_VALUE = "Bus";
+    private static final String INSTANCE_ID = "managed.bus.instance.id";
     private final Bus bus;
     
     public ManagedBus(Bus b) {
@@ -50,7 +52,11 @@ public class ManagedBus implements ManagedComponent {
         buffer.append(ManagementConstants.BUS_ID_PROP).append('=').append(busId).append(',');
         buffer.append(ManagementConstants.TYPE_PROP).append('=').append(TYPE_VALUE).append(',');
         // Added the instance id to make the ObjectName unique
-        buffer.append(ManagementConstants.INSTANCE_ID_PROP).append('=').append(bus.hashCode());
+        String instanceId = (String)bus.getProperties().get(INSTANCE_ID);
+        if (StringUtils.isEmpty(instanceId)) {
+            instanceId = new StringBuffer().append(bus.hashCode()).toString();
+        }
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP).append('=').append(instanceId);
         
 
         return new ObjectName(buffer.toString());


Mime
View raw message