Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 60309 invoked from network); 12 Oct 2006 12:44:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Oct 2006 12:44:05 -0000 Received: (qmail 98037 invoked by uid 500); 12 Oct 2006 12:44:05 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 98023 invoked by uid 500); 12 Oct 2006 12:44:05 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 98014 invoked by uid 99); 12 Oct 2006 12:44:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 05:44:05 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 05:44:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id D9B6A1A981A; Thu, 12 Oct 2006 05:43:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r463233 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java Date: Thu, 12 Oct 2006 12:43:43 -0000 To: activemq-commits@geronimo.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061012124343.D9B6A1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rajdavies Date: Thu Oct 12 05:43:42 2006 New Revision: 463233 URL: http://svn.apache.org/viewvc?view=rev&rev=463233 Log: Subscribers shout have unique ObjectNames - so use the ConsumerId as part of the object name - unless its a durable subscriber. Currently, we weren't allowing more than one consumer from the same client to be registered 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=463233&r1=463232&r2=463233 ============================================================================== --- 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 Thu Oct 12 05:43:42 2006 @@ -171,42 +171,48 @@ } } - 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, subscriptionID=" + JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getSubcriptionName()); - } else { - persistentMode = "Non-Durable"; + public ObjectName registerSubscription(ConnectionContext context,Subscription sub){ + Hashtable map=brokerObjectName.getKeyPropertyList(); + String objectNameStr=brokerObjectName.getDomain()+":"+"BrokerName="+map.get("BrokerName")+",Type=Subscription,"; + String destinationType="destinationType="+sub.getConsumerInfo().getDestination().getDestinationTypeAsString(); + String destinationName="destinationName=" + +JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getDestination().getPhysicalName()); + String clientId="clientId="+JMXSupport.encodeObjectNamePart(context.getClientId()); + String persistentMode="persistentMode="; + String consumerId=""; + SubscriptionKey key=new SubscriptionKey(context.getClientId(),sub.getConsumerInfo().getSubcriptionName()); + if(sub.getConsumerInfo().isDurable()){ + persistentMode+="Durable, subscriptionID=" + +JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getSubcriptionName()); + }else{ + persistentMode+="Non-Durable"; + if(sub.getConsumerInfo()!=null&&sub.getConsumerInfo().getConsumerId()!=null){ + consumerId=",consumerId=" + +JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getConsumerId().toString()); + } } - - 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) + ""); + objectNameStr+=persistentMode+","; + objectNameStr+=destinationType+","; + objectNameStr+=destinationName+","; + objectNameStr+=clientId; + objectNameStr+=consumerId; + try{ + ObjectName objectName=new ObjectName(objectNameStr); 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; } }