hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r981482 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
Date Mon, 02 Aug 2010 12:26:45 GMT
Author: olegk
Date: Mon Aug  2 12:26:44 2010
New Revision: 981482

URL: http://svn.apache.org/viewvc?rev=981482&view=rev
Log:
Fixed potential deadlock when interest op queuing is active

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=981482&r1=981481&r2=981482&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
Mon Aug  2 12:26:44 2010
@@ -442,17 +442,13 @@ public abstract class AbstractIOReactor 
         if (!this.interestOpsQueueing) {
             return;
         }
-        synchronized (this.interestOpsQueue) {
-            while (!this.interestOpsQueue.isEmpty()) {
-                // get the first queue element
-                InterestOpEntry entry = this.interestOpsQueue.remove();
-
-                // obtain the operation's details
-                SelectionKey key = entry.getSelectionKey();
-                int eventMask = entry.getEventMask();
-                if (key.isValid()) {
-                    key.interestOps(eventMask);
-                }
+        InterestOpEntry entry;
+        while ((entry = this.interestOpsQueue.poll()) != null) {
+            // obtain the operation's details
+            SelectionKey key = entry.getSelectionKey();
+            int eventMask = entry.getEventMask();
+            if (key.isValid()) {
+                key.interestOps(eventMask);
             }
         }
     }
@@ -474,10 +470,8 @@ public abstract class AbstractIOReactor 
             return false;
         }
 
-        synchronized (this.interestOpsQueue) {
-            // add this operation to the interestOps() queue
-            this.interestOpsQueue.add(entry);
-        }
+        // add this operation to the interestOps() queue
+        this.interestOpsQueue.add(entry);
 
         return true;
     }



Mime
View raw message