activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1036263 - /activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java
Date Wed, 17 Nov 2010 22:40:50 GMT
Author: chirino
Date: Wed Nov 17 22:40:49 2010
New Revision: 1036263

URL: http://svn.apache.org/viewvc?rev=1036263&view=rev
Log:
queue up the onConnected event so it always happens after the transport or is started.

Modified:
    activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java

Modified: activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java?rev=1036263&r1=1036262&r2=1036263&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransport.java
Wed Nov 17 22:40:49 2010
@@ -271,13 +271,19 @@ public class TcpTransport extends JavaBa
                 readSource.setCancelHandler(CANCEL_HANDLER);
                 readSource.resume();
             } else if (socketState.is(CONNECTED.class) ) {
-                trace("was connected.");
-                onConnected();
+                dispatchQueue.dispatchAsync(new Runnable() {
+                    public void run() {
+                        try {
+                            trace("was connected.");
+                            onConnected();
+                        } catch (IOException e) {
+                             onTransportFailure(e);
+                        }
+                    }
+                });
             } else {
                 System.err.println("cannot be started.  socket state is: "+socketState);

             }
-        } catch (IOException e) {
-            onTransportFailure(e);
         } finally {
             if( onCompleted!=null ) {
                 onCompleted.run();



Mime
View raw message