Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 20039 invoked from network); 17 Nov 2010 22:41:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Nov 2010 22:41:32 -0000 Received: (qmail 66646 invoked by uid 500); 17 Nov 2010 22:42:04 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 66624 invoked by uid 500); 17 Nov 2010 22:42:04 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 66617 invoked by uid 99); 17 Nov 2010 22:42:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Nov 2010 22:42:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Nov 2010 22:42:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 188C523889E0; Wed, 17 Nov 2010 22:40:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101117224050.188C523889E0@eris.apache.org> 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();