activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1079030 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apo...
Date Mon, 07 Mar 2011 23:44:53 GMT
Author: chirino
Date: Mon Mar  7 23:44:53 2011
New Revision: 1079030

URL: http://svn.apache.org/viewvc?rev=1079030&view=rev
Log:
Simpler more consistent naming..

Removed:
    activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServerSupport.java
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
    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-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
    activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java
    activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServer.java
    activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportServer.java
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.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=1079030&r1=1079029&r2=1079030&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
Mon Mar  7 23:44:53 2011
@@ -281,7 +281,7 @@ class Broker() extends BaseService {
         }
       }
       for (c <- config.connectors) {
-        val connector = new Connector(this, c.id)
+        val connector = new AcceptingConnector(this, c.id)
         connector.configure(c, LoggingReporter(VirtualHost))
         connectors ::= connector
       }
@@ -336,16 +336,22 @@ class Broker() extends BaseService {
     tracker.callback(on_completed)
   }
 
-  def getVirtualHost(name: AsciiBuffer) = dispatch_queue ! {
+  def get_virtual_host(name: AsciiBuffer) = dispatch_queue ! {
     virtual_hosts_by_hostname.getOrElse(name, null)
   }
 
-  def getDefaultVirtualHost = dispatch_queue ! {
+  def get_default_virtual_host = dispatch_queue ! {
     default_virtual_host
   }
 
   //useful for testing
-  def getFirstConnectorAddress() : InetSocketAddress = connectors.head.transport_server.getSocketAddress
+  def get_connect_address = {
+    Option(config.client_address).getOrElse(connectors.head.asInstanceOf[AcceptingConnector].transport_server.getConnectAddress)
+  }
+
+  def get_socket_address = {
+    connectors.head.asInstanceOf[AcceptingConnector].transport_server.getSocketAddress
+  }
 
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
Mon Mar  7 23:44:53 2011
@@ -91,18 +91,21 @@ abstract class Connection() extends Base
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class BrokerConnection(val connector: Connector, val id:Long) extends Connection {
+class BrokerConnection(var connector: Connector, val id:Long) extends Connection {
+  import Connection._
 
   var protocol_handler: ProtocolHandler = null;
 
   override def toString = "id: "+id.toString
 
   protected override  def _start(on_completed:Runnable) = {
+    info("Client connected from: %s", transport.getRemoteAddress)
     protocol_handler.set_connection(this);
     super._start(on_completed)
   }
 
   protected override def _stop(on_completed:Runnable) = {
+    info("Client disconnected from: %s", transport.getRemoteAddress)
     connector.stopped(this)
     super._stop(on_completed)
   }

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=1079030&r1=1079029&r2=1079030&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
Mon Mar  7 23:44:53 2011
@@ -61,13 +61,25 @@ object Connector extends Log {
 
 }
 
+trait Connector extends BaseService {
+
+  def broker:Broker
+  def id:String
+  def stopped(connection:BrokerConnection):Unit
+  def config:ConnectorDTO
+  def connections:HashMap[Long, BrokerConnection]
+  def connection_counter:LongCounter
+
+}
+
 /**
  * <p>
  * </p>
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class Connector(val broker:Broker, val id:String) extends BaseService {
+class AcceptingConnector(val broker:Broker, val id:String) extends Connector {
+
   import Connector._
 
   override val dispatch_queue = broker.dispatch_queue
@@ -77,7 +89,7 @@ class Connector(val broker:Broker, val i
   var protocol:Protocol = _
 
   val connections = HashMap[Long, BrokerConnection]()
-  val accept_counter = new LongCounter()
+  val connection_counter = new LongCounter()
 
   override def toString = "connector: "+config.id
 
@@ -91,8 +103,8 @@ class Connector(val broker:Broker, val i
         transport.setProtocolCodec(protocol.createProtocolCodec)
       }
 
-      accept_counter.incrementAndGet
-      var connection = new BrokerConnection(Connector.this, broker.connection_id_counter.incrementAndGet)
+      connection_counter.incrementAndGet
+      var connection = new BrokerConnection(AcceptingConnector.this, broker.connection_id_counter.incrementAndGet)
       connection.dispatch_queue.setLabel("connection %d to %s".format(connection.id, transport.getRemoteAddress))
       connection.protocol_handler = protocol.createProtocolHandler
       connection.transport = transport
@@ -100,8 +112,6 @@ class Connector(val broker:Broker, val i
       broker.init_dispatch_queue(connection.dispatch_queue)
 
       connections.put(connection.id, connection)
-      info("Client connected from: %s", connection.transport.getRemoteAddress)
-
       try {
         connection.start()
       } catch {
@@ -177,7 +187,6 @@ class Connector(val broker:Broker, val i
   def stopped(connection:BrokerConnection) = dispatch_queue {
     val at_limit = at_connection_limit
     if( connections.remove(connection.id).isDefined ) {
-      info("Client disconnected from: %s", connection.transport.getRemoteAddress)
       if( at_limit ) {
         transport_server.resume
       }

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=1079030&r1=1079029&r2=1079030&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
Mon Mar  7 23:44:53 2011
@@ -286,9 +286,7 @@ abstract class BrokerPerfSupport extends
     return consumer
   }
 
-  def connectUri(broker: Broker) = {
-    broker.connectors.head.transport_server.getConnectURI.toString
-  }
+  def connectUri(broker: Broker) = broker.get_connect_address
 
   def _createProducer(id: Int, messageSize: Int, destination: DestinationDTO): RemoteProducer
= {
     var producer = createProducer()

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
Mon Mar  7 23:44:53 2011
@@ -47,18 +47,12 @@ public class BrokerDTO {
     @XmlElement(name="connector")
     public List<ConnectorDTO> connectors = new ArrayList<ConnectorDTO>();
 
-
-    /**
-     * Internal IP address or host names of the broker
-     */
-    @XmlElement(name="internal_address")
-    public List<String> internal_addresses = new ArrayList<String>();
-
     /**
-     * External IP address or host names of the broker
+     * The clients should use to connect to this
+     * broker.
      */
-    @XmlElement(name="external_address")
-    public List<String> external_addresses = new ArrayList<String>();
+    @XmlElement(name="client_address")
+    public String client_address;
 
     /**
      * The base data directory of the broker.  It will store

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
Mon Mar  7 23:44:53 2011
@@ -598,9 +598,9 @@ class StompProtocolHandler extends Proto
       val host_header = get(headers, HOST)
       val host = host_header match {
         case None=>
-          connection.connector.broker.getDefaultVirtualHost
+          connection.connector.broker.get_default_virtual_host
         case Some(host)=>
-          connection.connector.broker.getVirtualHost(host)
+          connection.connector.broker.get_virtual_host(host)
       }
       resumeRead
 

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
Mon Mar  7 23:44:53 2011
@@ -34,7 +34,7 @@ class StompTestSupport extends FunSuiteS
       info("Loading broker configuration from the classpath with URI: " + broker_config_uri)
       broker = BrokerFactory.createBroker(broker_config_uri)
       ServiceControl.start(broker, "Starting broker")
-      port = broker.connectors.head.transport_server.getSocketAddress.getPort
+      port = broker.get_socket_address.getPort
     }
     catch {
       case e:Throwable => e.printStackTrace

Modified: activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java
Mon Mar  7 23:44:53 2011
@@ -58,8 +58,8 @@ public class TcpTransportServer implemen
         this.listener = listener;
     }
 
-    public URI getConnectURI() {
-        return connectURI;
+    public String getConnectAddress() {
+        return connectURI.toString();
     }
 
     public InetSocketAddress getSocketAddress() {

Modified: activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServer.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServer.java?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServer.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportServer.java
Mon Mar  7 23:44:53 2011
@@ -38,7 +38,7 @@ public interface TransportServer extends
      */
     void setAcceptListener(TransportAcceptListener acceptListener);
 
-    URI getConnectURI();
+    String getConnectAddress();
 
     /**
      * @return The socket address that this transport is accepting connections

Modified: activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportServer.java?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportServer.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportServer.java
Mon Mar  7 23:44:53 2011
@@ -46,8 +46,8 @@ public class PipeTransportServer impleme
     private CustomDispatchSource<PipeTransport,LinkedList<PipeTransport>> acceptSource;
 
 
-    public URI getConnectURI() {
-        return connectURI;
+    public String getConnectAddress() {
+        return connectURI.toString();
     }
 
     public InetSocketAddress getSocketAddress() {

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala?rev=1079030&r1=1079029&r2=1079030&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
Mon Mar  7 23:44:53 2011
@@ -412,7 +412,7 @@ case class RuntimeResource(parent:Broker
           result.state_since = connector.service_state.since
           result.config = connector.config
 
-          result.accepted = connector.accept_counter.get
+          result.accepted = connector.connection_counter.get
           connector.connections.foreach { case (id,connection) =>
             // TODO: may need to sync /w connection's dispatch queue
             result.connections.add( new LongIdLabeledDTO(id, connection.transport.getRemoteAddress
) )



Mime
View raw message