You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2011/05/03 19:25:47 UTC

svn commit: r1099142 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala

Author: chirino
Date: Tue May  3 17:25:46 2011
New Revision: 1099142

URL: http://svn.apache.org/viewvc?rev=1099142&view=rev
Log:
Don't assume all connectors will be AcceptingConnectors.

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

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1099142&r1=1099141&r2=1099142&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala Tue May  3 17:25:46 2011
@@ -33,6 +33,7 @@ import collection.mutable.{HashSet, Link
 import scala.util.Random
 import FileSupport._
 import org.apache.activemq.apollo.dto.{LogCategoryDTO, BrokerDTO}
+import org.apache.activemq.apollo.broker.AcceptingConnector
 
 /**
  * <p>
@@ -209,7 +210,6 @@ class Broker() extends BaseService {
 
   def id = "default"
   
-  val connector_id_counter = new LongCounter
   val connection_id_counter = new LongCounter
 
   var key_storage:KeyStorage = _
@@ -455,12 +455,13 @@ class Broker() extends BaseService {
 
   //useful for testing
   def get_connect_address = {
-    Option(config.client_address).getOrElse(connectors.head.asInstanceOf[AcceptingConnector].transport_server.getConnectAddress)
+    Option(config.client_address).getOrElse(first_accepting_connector.get.transport_server.getConnectAddress)
   }
 
   def get_socket_address = {
-    connectors.head.asInstanceOf[AcceptingConnector].transport_server.getSocketAddress
+    first_accepting_connector.get.transport_server.getSocketAddress
   }
 
+  def first_accepting_connector = connectors.find(_.isInstanceOf[AcceptingConnector]).map(_.asInstanceOf[AcceptingConnector])
 
 }