You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2008/06/23 23:28:08 UTC

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

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(