activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r515466 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Date Wed, 07 Mar 2007 06:01:00 GMT
Author: rajdavies
Date: Tue Mar  6 22:01:00 2007
New Revision: 515466

URL: http://svn.apache.org/viewvc?view=rev&rev=515466
Log:
not a problem to try and create a destination more than once

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?view=diff&rev=515466&r1=515465&r2=515466
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Tue Mar  6 22:01:00 2007
@@ -97,33 +97,25 @@
         destinations.clear();
     }
     
-    public Destination addDestination(ConnectionContext context, ActiveMQDestination destination)
throws Exception {
+    public Destination addDestination(ConnectionContext context,ActiveMQDestination destination)
throws Exception{
         log.debug("Adding destination: "+destination);
-        
-        synchronized (destinationsMutex) {
-            Destination dest = (Destination) destinations.get(destination);
-            if (dest != null) {
-                log.warn("Attempt to add destination which is already created: " + destination);
-            }
-            else {
-                dest = createDestination(context, destination);
-
+        synchronized(destinationsMutex){
+            Destination dest=(Destination)destinations.get(destination);
+            if(dest==null){
+                dest=createDestination(context,destination);
                 // intercept if there is a valid interceptor defined
-                DestinationInterceptor destinationInterceptor = broker.getDestinationInterceptor();
-                if (destinationInterceptor != null) {
-                    dest = destinationInterceptor.intercept(dest);
+                DestinationInterceptor destinationInterceptor=broker.getDestinationInterceptor();
+                if(destinationInterceptor!=null){
+                    dest=destinationInterceptor.intercept(dest);
                 }
-                
                 dest.start();
-
-                destinations.put(destination, dest);
-                destinationMap.put(destination, dest);
-
+                destinations.put(destination,dest);
+                destinationMap.put(destination,dest);
                 // Add all consumers that are interested in the destination.
-                for (Iterator iter = subscriptions.values().iterator(); iter.hasNext();)
{
-                    Subscription sub = (Subscription) iter.next();
-                    if (sub.matches(destination)) {
-                        dest.addSubscription(context, sub);
+                for(Iterator iter=subscriptions.values().iterator();iter.hasNext();){
+                    Subscription sub=(Subscription)iter.next();
+                    if(sub.matches(destination)){
+                        dest.addSubscription(context,sub);
                     }
                 }
             }



Mime
View raw message