activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1405941 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
Date Mon, 05 Nov 2012 20:32:24 GMT
Author: chirino
Date: Mon Nov  5 20:32:23 2012
New Revision: 1405941

URL: http://svn.apache.org/viewvc?rev=1405941&view=rev
Log:
removing un-needed producer retain/release

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala?rev=1405941&r1=1405940&r2=1405941&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
Mon Nov  5 20:32:23 2012
@@ -1064,41 +1064,36 @@ class LocalRouter(val virtual_host:Virtu
 
   def connect(addresses: Array[_ <: ConnectAddress], producer: BindableDeliveryProducer,
security: SecurityContext):Option[String] = {
     dispatch_queue.assertExecuting()
-    producer.retain
-    try {
-      if(!virtual_host.service_state.is_started) {
-        return Some("virtual host stopped.")
-      } else {
-        val actions = addresses.map { address =>
-          address.domain match {
-            case "topic" =>
-              val allowed = topic_domain.can_connect_all(address, producer, security)
-              def perform() = topic_domain.connect(address, producer, security)
-              (allowed, perform _)
-            case "queue" =>
-              val allowed = queue_domain.can_connect_all(address, producer, security)
-              def perform() = queue_domain.connect(address, producer, security)
-              (allowed, perform _)
-            case "dsub" =>
-              val allowed = dsub_domain.can_connect_all(address, producer, security)
-              def perform() = dsub_domain.connect(address, producer, security)
-              (allowed, perform _)
-            case _ => sys.error("Unknown domain: "+address.domain)
-          }
-        }
-  
-        val failures = actions.flatMap(_._1)
-        if( !failures.isEmpty ) {
-          return Some(failures.mkString("; "))
-        } else {
-          actions.foreach(_._2())
-          producer.connected()
-          producer.retain()
-          return None
+    if(!virtual_host.service_state.is_started) {
+      return Some("virtual host stopped.")
+    } else {
+      val actions = addresses.map { address =>
+        address.domain match {
+          case "topic" =>
+            val allowed = topic_domain.can_connect_all(address, producer, security)
+            def perform() = topic_domain.connect(address, producer, security)
+            (allowed, perform _)
+          case "queue" =>
+            val allowed = queue_domain.can_connect_all(address, producer, security)
+            def perform() = queue_domain.connect(address, producer, security)
+            (allowed, perform _)
+          case "dsub" =>
+            val allowed = dsub_domain.can_connect_all(address, producer, security)
+            def perform() = dsub_domain.connect(address, producer, security)
+            (allowed, perform _)
+          case _ => sys.error("Unknown domain: "+address.domain)
         }
       }
-    } finally {
-      producer.release
+
+      val failures = actions.flatMap(_._1)
+      if( !failures.isEmpty ) {
+        return Some(failures.mkString("; "))
+      } else {
+        actions.foreach(_._2())
+        producer.connected()
+        producer.retain()
+        return None
+      }
     }
   }
 



Mime
View raw message