activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
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 GMT
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 {



Mime
View raw message