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/04/27 20:20:13 UTC

svn commit: r1097193 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/main/scala/org/apache/activemq/a...

Author: chirino
Date: Wed Apr 27 18:20:12 2011
New Revision: 1097193

URL: http://svn.apache.org/viewvc?rev=1097193&view=rev
Log:
Rename the multi protocol to any since that reads better from the point of view of config: protocol="any"

Added:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
      - copied, changed from r1097190, activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
Removed:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index?rev=1097193&r1=1097192&r2=1097193&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index Wed Apr 27 18:20:12 2011
@@ -14,4 +14,4 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.protocol.MultiProtocolFactory
\ No newline at end of file
+org.apache.activemq.apollo.broker.protocol.AnyProtocolFactory
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala?rev=1097193&r1=1097192&r2=1097193&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala Wed Apr 27 18:20:12 2011
@@ -42,7 +42,7 @@ object Connector extends Log {
     val rc = new ConnectorDTO
     rc.id = "default"
     rc.bind = "tcp://0.0.0.0:61613"
-    rc.protocol = "multi"
+    rc.protocol = "any"
     rc.connection_limit = 1000
     rc
   }
@@ -150,7 +150,7 @@ class AcceptingConnector(val broker:Brok
 
   override def _start(on_completed:Runnable) = {
     assert(config!=null, "Connector must be configured before it is started.")
-    protocol = ProtocolFactory.get(config.protocol.getOrElse("multi")).get
+    protocol = ProtocolFactory.get(config.protocol.getOrElse("any")).get
     transport_server = TransportFactory.bind( config.bind )
     transport_server.setDispatchQueue(dispatch_queue)
     transport_server.setAcceptListener(BrokerAcceptListener)

Copied: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala (from r1097190, activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala?p2=activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala&p1=activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala&r1=1097190&r2=1097193&rev=1097193&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala Wed Apr 27 18:20:12 2011
@@ -34,24 +34,24 @@ import org.apache.activemq.apollo.transp
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class MultiProtocolFactory extends ProtocolFactory.Provider {
+class AnyProtocolFactory extends ProtocolFactory.Provider {
 
   def all_protocols: Array[Protocol] = ((ProtocolFactory.provider.singletons.map(_.create())).filter(_.isIdentifiable)).toArray
 
   def create() = {
-    new MultiProtocol(()=>all_protocols)
+    new AnyProtocol(()=>all_protocols)
   }
 
   def create(config: String): Protocol = {
-    val MULTI = "multi"
-    val MULTI_PREFIXED = "multi:"
+    val MULTI = "any"
+    val MULTI_PREFIXED = "any:"
 
     if (config == MULTI) {
-      return new MultiProtocol(()=>all_protocols)
+      return new AnyProtocol(()=>all_protocols)
     } else if (config.startsWith(MULTI_PREFIXED)) {
       var names: Array[String] = config.substring(MULTI_PREFIXED.length).split(',')
       var protocols: Array[Protocol] = (names.flatMap {x => ProtocolFactory.get(x.trim)}).toArray
-      return new MultiProtocol(()=>protocols)
+      return new AnyProtocol(()=>protocols)
     }
     return null
   }
@@ -64,15 +64,15 @@ class MultiProtocolFactory extends Proto
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class MultiProtocol(val func: ()=>Array[Protocol]) extends Protocol {
+class AnyProtocol(val func: ()=>Array[Protocol]) extends Protocol {
 
   lazy val protocols: Array[Protocol] = func()
 
-  def protocol = "multi"
+  def protocol = "any"
 
-  def createProtocolCodec = new MultiProtocolCodec(protocols)
+  def createProtocolCodec = new AnyProtocolCodec(protocols)
 
-  def createProtocolHandler = new MultiProtocolHandler
+  def createProtocolHandler = new AnyProtocolHandler
 
   def encode(message: Message) = throw new UnsupportedOperationException
 
@@ -86,7 +86,7 @@ class MultiProtocol(val func: ()=>Array[
 
 }
 
-class MultiProtocolCodec(val protocols: Array[Protocol]) extends ProtocolCodec {
+class AnyProtocolCodec(val protocols: Array[Protocol]) extends ProtocolCodec {
 
   if (protocols.isEmpty) {
     throw new IllegalArgumentException("No protocol configured for identification.")
@@ -131,16 +131,16 @@ class MultiProtocolCodec(val protocols: 
 
   def getWriteCounter = 0L
 
-  def protocol = "multi"
+  def protocol = "any"
 
 }
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class MultiProtocolHandler extends ProtocolHandler {
+class AnyProtocolHandler extends ProtocolHandler {
 
-  def protocol = "multi"
+  def protocol = "any"
 
   var discriminated = false
 
@@ -160,13 +160,12 @@ class MultiProtocolHandler extends Proto
         throw new ProtocolException("No protocol handler available for protocol: " + protocol);
     }
 
-    protocol_handler.set_connection(connection);
-
-    // replace the current handler with the new one.
+     // replace the current handler with the new one.
     connection.protocol_handler = protocol_handler
     connection.transport.setProtocolCodec(codec)
-
     connection.transport.suspendRead
+
+    protocol_handler.set_connection(connection);
     protocol_handler.on_transport_connected
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala?rev=1097193&r1=1097192&r2=1097193&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala Wed Apr 27 18:20:12 2011
@@ -193,7 +193,7 @@ abstract class BrokerPerfSupport extends
 
   protected def createProducer(): RemoteProducer
 
-  def getBrokerProtocolName() = "multi"
+  def getBrokerProtocolName() = "any"
 
   def getRemoteProtocolName(): String
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml?rev=1097193&r1=1097192&r2=1097193&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml Wed Apr 27 18:20:12 2011
@@ -21,5 +21,5 @@
         <host_name>localhost</host_name>
         <bdb_store directory="${apollo.base}/data" flush_delay="100"/>
     </virtual_host>
-    <connector protocol="multi" bind="tcp://0.0.0.0:61613" id="default"/>
+    <connector bind="tcp://0.0.0.0:61613" id="default"/>
 </broker>