Author: robbie
Date: Tue Sep 27 11:02:47 2011
New Revision: 1176326

URL: http://svn.apache.org/viewvc?rev=1176326&view=rev
Log:
QPID-3507: move the MessageListener check in front of the _receiving CAS

Applied patch from Oleksandr Rudyy<oru...@gmail.com>

Modified:
    
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java

Modified: 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java?rev=1176326&r1=1176325&r2=1176326&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
 (original)
+++ 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
 Tue Sep 27 11:02:47 2011
@@ -323,14 +323,14 @@ public abstract class BasicMessageConsum
             }
         }
 
-        if (!_receiving.compareAndSet(false, true))
+        if (isMessageListenerSet())
         {
-            throw new javax.jms.IllegalStateException("Another thread is 
already receiving.");
+            throw new javax.jms.IllegalStateException("A listener has already 
been set.");
         }
 
-        if (isMessageListenerSet())
+        if (!_receiving.compareAndSet(false, true))
         {
-            throw new javax.jms.IllegalStateException("A listener has already 
been set.");
+            throw new javax.jms.IllegalStateException("Another thread is 
already receiving.");
         }
 
         _receivingThread = Thread.currentThread();



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to