Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 63570 invoked from network); 18 Apr 2008 22:06:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2008 22:06:29 -0000 Received: (qmail 37089 invoked by uid 500); 18 Apr 2008 22:06:30 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 37074 invoked by uid 500); 18 Apr 2008 22:06:30 -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 37065 invoked by uid 99); 18 Apr 2008 22:06:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 15:06:30 -0700 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.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 22:05:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B703D1A9832; Fri, 18 Apr 2008 15:06:08 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r649708 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java Date: Fri, 18 Apr 2008 22:06:08 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080418220608.B703D1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: chirino Date: Fri Apr 18 15:06:04 2008 New Revision: 649708 URL: http://svn.apache.org/viewvc?rev=649708&view=rev Log: When sending directly, do it outside the valve lock to avoid a deadlock Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java?rev=649708&r1=649707&r2=649708&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java Fri Apr 18 15:06:04 2008 @@ -77,6 +77,8 @@ throw new IOException("Peer not connected."); } + + TransportListener transportListener=null; try { // Disable the peer from changing his state while we try to enqueue onto him. peer.enqueueValve.increment(); @@ -90,11 +92,7 @@ peer.getMessageQueue().put(command); peer.wakeup(); } else { - if( command == DISCONNECT ) { - peer.transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed.")); - } else { - peer.transportListener.onCommand(command); - } + transportListener = peer.transportListener; } enqueueValve.decrement(); } else { @@ -108,6 +106,13 @@ peer.enqueueValve.decrement(); } + if( transportListener!=null ) { + if( command == DISCONNECT ) { + transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed.")); + } else { + transportListener.onCommand(command); + } + } } public void start() throws Exception {