cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/3] git commit: CXF-5718 Suppose to override the instance.id of the managed endpoint with persistent one
Date Wed, 30 Apr 2014 08:45:36 GMT
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/715d24ac
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/715d24ac
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/715d24ac

Branch: refs/heads/2.7.x-fixes
Commit: 715d24acf463b14a56e06527aed02ccf8cb057ba
Parents: a54d329
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Apr 30 16:41:32 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Apr 30 16:43:18 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/715d24ac/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java b/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
index cd8fc28..c548adf 100644
--- a/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
+++ b/api/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());


Mime
View raw message