activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1035637 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/ apollo-cli/src/test/resources/example-broker/etc/ apol...
Date Tue, 16 Nov 2010 14:01:43 GMT
Author: chirino
Date: Tue Nov 16 14:01:42 2010
New Revision: 1035637

URL: http://svn.apache.org/viewvc?rev=1035637&view=rev
Log:
adding in a option to set a connection limit per connector.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/activemq-stomp.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml
    activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java

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=1035637&r1=1035636&r2=1035637&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
Tue Nov 16 14:01:42 2010
@@ -24,6 +24,7 @@ import collection.mutable.HashMap
 import org.apache.activemq.apollo.transport._
 import org.apache.activemq.apollo.util._
 import ReporterLevel._
+import org.apache.activemq.apollo.util.OptionSupport._
 
 
 /**
@@ -45,6 +46,7 @@ object Connector extends Log {
     rc.advertise = "tcp://localhost:61613"
     rc.bind = "tcp://0.0.0.0:61613"
     rc.protocol = "multi"
+    rc.connection_limit = 1000
     rc
   }
 
@@ -113,9 +115,17 @@ class Connector(val broker:Broker, val i
           onAcceptError(e1)
         }
       }
+
+      // We may need to stop acepting connections..
+      if(at_connection_limit) {
+        transportServer.suspend
+      }
     }
   }
 
+  def at_connection_limit = {
+    connections.size >= config.connection_limit.getOrElse(Integer.MAX_VALUE)
+  }
 
   /**
    * Validates and then applies the configuration.
@@ -162,9 +172,13 @@ class Connector(val broker:Broker, val i
    * stop tracking them.
    */
   def stopped(connection:BrokerConnection) = dispatchQueue {
+    val at_limit = at_connection_limit
     if( connections.remove(connection.id).isDefined ) {
       info("Client disconnected from: %s", connection.transport.getRemoteAddress)
       connection.dispatchQueue.release
+      if( at_limit ) {
+        transportServer.resume
+      }
     }
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml?rev=1035637&r1=1035636&r2=1035637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
Tue Nov 16 14:01:42 2010
@@ -15,14 +15,15 @@
 -->
 <broker basedir="./activemq-data/default" rev="1" enabled="true" id="default" xmlns="http://activemq.apache.org/schema/activemq/apollo">
     <notes>
-      A default configuration
+      The default configuration.
     </notes>
 
-    <virtual-host purge-on-startup="false" auto-create-queues="true" enabled="true" id="default">
+    <virtual-host id="default" auto-create-queues="true" >
         <host-name>localhost</host-name>
+        <host-name>127.0.0.1</host-name>
         <hawtdb-store directory="${apollo.base}/data"/>
     </virtual-host>
 
-    <connectors advertise="tcp://localhost:61613" protocol="multi" bind="tcp://0.0.0.0:61613"
enabled="true" id="default"/>
+    <connector id="port-61613" bind="tcp://0.0.0.0:61613" connection-limit="2000" protocol="multi"/>
 
 </broker>

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=1035637&r1=1035636&r2=1035637&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
Tue Nov 16 14:01:42 2010
@@ -7,5 +7,5 @@
         <host-name>localhost</host-name>
         <bdb-store directory="${apollo.base}/data" flush-delay="100"/>
     </virtual-host>
-    <connectors advertise="tcp://localhost:61613" protocol="multi" bind="tcp://0.0.0.0:61613"
enabled="true" id="default"/>
+    <connector advertise="tcp://localhost:61613" protocol="multi" bind="tcp://0.0.0.0:61613"
enabled="true" id="default"/>
 </broker>

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=1035637&r1=1035636&r2=1035637&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
Tue Nov 16 14:01:42 2010
@@ -53,14 +53,15 @@ public class BrokerDTO extends ServiceDT
     /**
      * A broker can service many virtual hosts.
      */
+    @JsonProperty("virtual_hosts")
     @XmlElement(name="virtual-host")
     public List<VirtualHostDTO> virtual_hosts = new ArrayList<VirtualHostDTO>();
 
     /**
      * A broker accepts connections via it's configured connectors.
      */
-    @JsonProperty
-    @XmlElement
+    @JsonProperty("connectors")
+    @XmlElement(name="connector")
     public List<ConnectorDTO> connectors = new ArrayList<ConnectorDTO>();
 
     /**

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java?rev=1035637&r1=1035636&r2=1035637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
Tue Nov 16 14:01:42 2010
@@ -50,5 +50,10 @@ public class ConnectorDTO extends Servic
     @JsonProperty
     @XmlAttribute
     public String advertise;
+
+    @JsonProperty
+    @XmlAttribute(name="connection-limit")
+    public Integer connection_limit;
+
     
 }
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java?rev=1035637&r1=1035636&r2=1035637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
Tue Nov 16 14:01:42 2010
@@ -58,7 +58,7 @@ public class VirtualHostDTO extends Serv
     /**
      * Should connections get regroups so they get serviced by the same thread?
      */
-    @XmlAttribute(name="regroup_connections")
+    @XmlAttribute(name="regroup-connections")
     public Boolean regroup_connections;
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/activemq-stomp.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/activemq-stomp.xml?rev=1035637&r1=1035636&r2=1035637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/activemq-stomp.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/activemq-stomp.xml Tue
Nov 16 14:01:42 2010
@@ -20,5 +20,5 @@
     <virtual-host purge-on-startup="false" auto-create-queues="true" enabled="true" id="default">
         <host-name>localhost</host-name>
     </virtual-host>
-    <connectors advertise="tcp://localhost:61613" protocol="stomp" bind="tcp://0.0.0.0:0"
enabled="true" id="default"/>
+    <connector advertise="tcp://localhost:61613" protocol="stomp" bind="tcp://0.0.0.0:0"
enabled="true" id="default"/>
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml?rev=1035637&r1=1035636&r2=1035637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml Tue
Nov 16 14:01:42 2010
@@ -23,6 +23,6 @@
     </virtual-host>
 
     <key-storage file="${basedir}/src/test/resources/apollo.ks" password="password" key-password="password"/>
-    <connectors protocol="stomp" bind="ssl://0.0.0.0:0" enabled="true" id="default"/>
+    <connector protocol="stomp" bind="ssl://0.0.0.0:0" enabled="true" id="default"/>
 
 </broker>
\ No newline at end of file

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=1035637&r1=1035636&r2=1035637&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
Tue Nov 16 14:01:42 2010
@@ -75,7 +75,7 @@ public class TcpTransportServer implemen
     }
 
     public void suspend() {
-        acceptSource.resume();
+        acceptSource.suspend();
     }
 
     public void resume() {



Mime
View raw message