activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r452346 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Date Tue, 03 Oct 2006 08:33:16 GMT
Author: jlim
Date: Tue Oct  3 01:33:15 2006
New Revision: 452346

URL: http://svn.apache.org/viewvc?view=rev&rev=452346
Log:
updates for https://issues.apache.org/activemq/browse/AMQ-834 and https://issues.apache.org/activemq/browse/AMQ-833

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java?view=diff&rev=452346&r1=452345&r2=452346
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Tue Oct  3 01:33:15 2006
@@ -168,33 +168,42 @@
         }
     }
 
-    public ObjectName registerSubscription(ConnectionContext context,Subscription sub){
-        Hashtable map=brokerObjectName.getKeyPropertyList();
-        String name="";
-        SubscriptionKey key=new SubscriptionKey(context.getClientId(),sub.getConsumerInfo().getSubcriptionName());
-        if(sub.getConsumerInfo().isDurable()){
-            name=key.toString();
-        }else{
-            name=sub.getConsumerInfo().getConsumerId().toString();
+    public ObjectName registerSubscription(ConnectionContext context, Subscription sub) {
+        Hashtable map = brokerObjectName.getKeyPropertyList();
+        String persistentMode = "";
+        String destinationType = "";
+        String destinationName = "";
+        String clientID = "";
+        SubscriptionKey key = new SubscriptionKey(context.getClientId(), sub.getConsumerInfo().getSubcriptionName());
+        if (sub.getConsumerInfo().isDurable()) {
+            persistentMode = "Durable";
+
+        } else {
+            persistentMode = "Non-Durable";
         }
-        try{
-            ObjectName objectName=new ObjectName(brokerObjectName.getDomain()+":"+"BrokerName="+map.get("BrokerName")
-                            +","+"Type=Subscription,"+"active=true,"+"name="+JMXSupport.encodeObjectNamePart(name)+"");
+
+        destinationType = sub.getConsumerInfo().getDestination().getDestinationTypeAsString();
+        destinationName = sub.getConsumerInfo().getDestination().getPhysicalName();
+        clientID = context.getClientId();
+
+        try {
+            ObjectName objectName = new ObjectName(brokerObjectName.getDomain() + ":" + "BrokerName="
+ map.get("BrokerName")
+                    + "," + "Type=Subscription, persistentMode=" + persistentMode + ", destinationType="
+ destinationType + " ,destinationName=" + JMXSupport.encodeObjectNamePart(destinationName)
+ " ,clientID=" + JMXSupport.encodeObjectNamePart(clientID) + "");
             SubscriptionView view;
-            if(sub.getConsumerInfo().isDurable()){
-                view=new DurableSubscriptionView(this,context.getClientId(),sub);
-            }else{
-                if(sub instanceof TopicSubscription){
-                    view=new TopicSubscriptionView(context.getClientId(),(TopicSubscription)
sub);
-                }else{
-                    view=new SubscriptionView(context.getClientId(),sub);
+            if (sub.getConsumerInfo().isDurable()) {
+                view = new DurableSubscriptionView(this, context.getClientId(), sub);
+            } else {
+                if (sub instanceof TopicSubscription) {
+                    view = new TopicSubscriptionView(context.getClientId(), (TopicSubscription)
sub);
+                } else {
+                    view = new SubscriptionView(context.getClientId(), sub);
                 }
             }
-            registerSubscription(objectName,sub.getConsumerInfo(),key,view);
-            subscriptionMap.put(sub,objectName);
+            registerSubscription(objectName, sub.getConsumerInfo(), key, view);
+            subscriptionMap.put(sub, objectName);
             return objectName;
-        }catch(Exception e){
-            log.error("Failed to register subscription "+sub,e);
+        } catch (Exception e) {
+            log.error("Failed to register subscription " + sub, e);
             return null;
         }
     }



Mime
View raw message