activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1332222 - /activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
Date Mon, 30 Apr 2012 14:34:39 GMT
Author: chirino
Date: Mon Apr 30 14:34:39 2012
New Revision: 1332222

URL: http://svn.apache.org/viewvc?rev=1332222&view=rev
Log:
Producers were holding on to large 64k buffers needlessly.

Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala

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=1332222&r1=1332221&r2=1332222&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 Apr 30 14:34:39 2012
@@ -1055,8 +1055,10 @@ class StompProtocolHandler extends Proto
     val dest = get(frame.headers, DESTINATION).get
     producerRoutes.get(dest) match {
       case null =>
+        // Deep copy to avoid holding onto a 64k buffer
+        val trimmed_dest = dest.deepCopy().ascii()
         // create the producer route...
-        val route = new StompProducerRoute(dest)   // don't process frames until producer
is connected...
+        val route = new StompProducerRoute(trimmed_dest)   // don't process frames until
producer is connected...
         connection.transport.suspendRead
         host.dispatch_queue {
           val rc = host.router.connect(route.addresses, route, security_context)
@@ -1067,7 +1069,7 @@ class StompProtocolHandler extends Proto
               case None =>
                 if (!connection.stopped) {
                   resume_read
-                  producerRoutes.put(dest, route)
+                  producerRoutes.put(trimmed_dest, route)
                   send_via_route(route.addresses, route, frame, uow)
                 }
             }
@@ -1200,9 +1202,10 @@ class StompProtocolHandler extends Proto
       }
 
       if( receipt!=null ) {
+        val trimmed_receipt = receipt.deepCopy().ascii()
         delivery.ack = { (consumed, uow) =>
           dispatchQueue <<| ^{
-            connection_sink.offer(StompFrame(RECEIPT, List((RECEIPT_ID, receipt))))
+            connection_sink.offer(StompFrame(RECEIPT, List((RECEIPT_ID, trimmed_receipt))))
           }
         }
       }



Mime
View raw message