Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes e4da1a1f1 -> 5ff29eb82
  refs/heads/2.7.x-fixes a54d32972 -> 715d24acf
  refs/heads/master 713410ebe -> a6eaa6b0e


CXF-5718 Suppose to override the instance.id of the managed endpoint with 
persistent one


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

Branch: refs/heads/master
Commit: a6eaa6b0ed6e2407a85d9314a7a05f10ce2de0d3
Parents: 713410e
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Wed Apr 30 16:41:32 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Wed Apr 30 16:42:21 2014 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/endpoint/ManagedEndpoint.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a6eaa6b0/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java 
b/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
index cd8fc28..c548adf 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
@@ -36,6 +36,7 @@ import org.apache.cxf.management.annotation.ManagedResource;
 public class ManagedEndpoint implements ManagedComponent, 
ServerLifeCycleListener {
     public static final String ENDPOINT_NAME = "managed.endpoint.name";
     public static final String SERVICE_NAME = "managed.service.name";
+    public static final String INSTANCE_ID = "managed.instance.id";
 
     protected final Bus bus;
     protected final Endpoint endpoint;
@@ -109,8 +110,12 @@ public class ManagedEndpoint implements ManagedComponent, 
ServerLifeCycleListene
         }
         endpointName = ObjectName.quote(endpointName);
         
buffer.append(ManagementConstants.PORT_NAME_PROP).append('=').append(endpointName).append(',');
+        String instanceId = (String)endpoint.get(INSTANCE_ID);
+        if (StringUtils.isEmpty(instanceId)) {
+            instanceId = new 
StringBuffer().append(endpoint.hashCode()).toString();
+        }
         // Added the instance id to make the ObjectName unique
-        
buffer.append(ManagementConstants.INSTANCE_ID_PROP).append('=').append(endpoint.hashCode());
+        
buffer.append(ManagementConstants.INSTANCE_ID_PROP).append('=').append(instanceId);
         
         //Use default domain name of server
         return new ObjectName(buffer.toString());

Reply via email to