hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r670768 - /httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
Date Mon, 23 Jun 2008 21:28:08 GMT
Author: olegk
Date: Mon Jun 23 14:28:08 2008
New Revision: 670768

URL: http://svn.apache.org/viewvc?rev=670768&view=rev
Log:
Ensure new channels get correctly distributed among I/O dispatchers even if the currentWorker
count wraps over Integer.MAX

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

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=670768&r1=670767&r2=670768&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
Mon Jun 23 14:28:08 2008
@@ -257,7 +257,8 @@
 
     protected void addChannel(final ChannelEntry entry) {
         // Distribute new channels among the workers
-        this.dispatchers[this.currentWorker++ % this.workerCount].addChannel(entry);
+        int i = Math.abs(this.currentWorker++ % this.workerCount);
+        this.dispatchers[i].addChannel(entry);
     }
     
     protected SelectionKey registerChannel(



Mime
View raw message