activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r418306 - /incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Date Fri, 30 Jun 2006 15:06:06 GMT
Author: chirino
Date: Fri Jun 30 08:06:05 2006
New Revision: 418306

URL: http://svn.apache.org/viewvc?rev=418306&view=rev
Log:
If the server and client are configured to disable async dispatch, the servlet could cause
a deadlock due to the way
it was syncing on the WebClient     

Modified:
    incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java

Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?rev=418306&r1=418305&r2=418306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
(original)
+++ incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Fri Jun 30 08:06:05 2006
@@ -435,25 +435,25 @@
             lastAccess=System.currentTimeMillis();
         }
         
-        public void setContinuation(Continuation continuation) {
-            synchronized (client) {
-                this.continuation = continuation;
-            }
+        synchronized public void setContinuation(Continuation continuation) {
+            this.continuation = continuation;
         }
 
-        public void onMessageAvailable(MessageConsumer consumer) {
-            synchronized (client) {
-                if (log.isDebugEnabled()) {
-                    log.debug("message for "+consumer+"continuation="+continuation);
-                }
-                if (continuation != null)
-                    continuation.resume();
-                else if (System.currentTimeMillis()-lastAccess>2*maximumReadTimeout)
-                {
-                    client.closeConsumers();
-                }
-                continuation = null;
+        synchronized public void onMessageAvailable(MessageConsumer consumer) {
+            if (log.isDebugEnabled()) {
+                log.debug("message for "+consumer+"continuation="+continuation);
+            }
+            if (continuation != null)
+                continuation.resume();
+            else if (System.currentTimeMillis()-lastAccess>2*maximumReadTimeout)
+            {
+                new Thread() {
+                    public void run() {
+                        client.closeConsumers();
+                    };
+                }.start();
             }
+            continuation = null;
         }
 
     }



Mime
View raw message