activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r729498 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
Date Fri, 26 Dec 2008 14:31:09 GMT
Author: dejanb
Date: Fri Dec 26 06:31:09 2008
New Revision: 729498

URL: http://svn.apache.org/viewvc?rev=729498&view=rev
Log:
fix for https://issues.apache.org/activemq/browse/AMQ-2044

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java?rev=729498&r1=729497&r2=729498&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
Fri Dec 26 06:31:09 2008
@@ -104,7 +104,7 @@
             synchronized(this) {
 	            // If there was nothing dispatched.. we may need to setup a timeout.
 	            if (dispatchCounterBeforePull == dispatchCounter) {
-	                // imediate timeout used by receiveNoWait()
+	                // immediate timeout used by receiveNoWait()
 	                if (pull.getTimeout() == -1) {
 	                    // Send a NULL message.
 	                    add(QueueMessageReference.NULL_MESSAGE);
@@ -128,13 +128,15 @@
      * Occurs when a pull times out. If nothing has been dispatched since the
      * timeout was setup, then send the NULL message.
      */
-    final synchronized void pullTimeout(long dispatchCounterBeforePull) {
+    final void pullTimeout(long dispatchCounterBeforePull) {
         if (dispatchCounterBeforePull == dispatchCounter) {
-            try {
-                add(QueueMessageReference.NULL_MESSAGE);
-                dispatchPending();
-            } catch (Exception e) {
-                context.getConnection().serviceException(e);
+            synchronized (pendingLock) {
+                try {
+                    add(QueueMessageReference.NULL_MESSAGE);
+                    dispatchPending();
+                } catch (Exception e) {
+                    context.getConnection().serviceException(e);
+                }
             }
         }
     }



Mime
View raw message