activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1439560 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
Date Mon, 28 Jan 2013 18:56:55 GMT
Author: chirino
Date: Mon Jan 28 18:56:54 2013
New Revision: 1439560

URL: http://svn.apache.org/viewvc?rev=1439560&view=rev
Log:
Fixing APLO-285: Websocket warnings
- Add in better exception handling on a websocket transport write.

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

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala?rev=1439560&r1=1439559&r2=1439560&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/WebSocketTransportFactory.scala
Mon Jan 28 18:56:54 2013
@@ -545,6 +545,7 @@ object WebSocketTransportFactory extends
       }
     }
 
+    var write_failed = false
     def write(buf: ByteBuffer):Int = {
       dispatchQueue.assertExecuting
       val remaining = buf.remaining()
@@ -555,12 +556,22 @@ object WebSocketTransportFactory extends
         outbound_capacity_remaining -= remaining;
         var buffer = new Buffer(buf.array(), buf.arrayOffset(), buf.remaining())
         outbound_executor {
-          if( !binary_transfers ) {
-            connection.sendMessage(buffer.ascii().toString)
-          } else {
-            connection.sendMessage(buffer.data, buffer.offset, buffer.length)
+          if( service_state.is_starting_or_started || !write_failed) {
+            try {
+              if (!binary_transfers) {
+                connection.sendMessage(buffer.ascii().toString)
+              } else {
+                connection.sendMessage(buffer.data, buffer.offset, buffer.length)
+              }
+              outbound_executor.outbound_drained += remaining
+            } catch {
+              case e:IOException =>
+                write_failed = true
+                dispatch_queue {
+                  transportListener.onTransportFailure(e)
+                }
+            }
           }
-          outbound_executor.outbound_drained += remaining
         }
         buf.position(buf.position()+ remaining);
         return remaining



Mime
View raw message