hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quintin Beukes" <quin...@last.za.net>
Subject Re: isStale()
Date Mon, 23 Jun 2008 18:13:44 GMT
Hey,

One can either modify the the method to either
(1) Implement a priority queue, which will give a perfect distribution.
(2) Modify the method to do this:
int i;
synchronized (this)
{
  int i = this.currentWorker++ % this.workerCount;
  if (i == 0) this.currentWorker = 1;
}
this.dispatchers[i].addChannel(entry);

On 6/23/08, Oleg Kalnichevski <olegk@apache.org> wrote:
> On Sun, 2008-06-22 at 23:04 +0200, Quintin Beukes wrote:
>  > Hey,
>  >
>  > I was busy stepping the NIO code, and noticed the following:
>  > this.dispatchers[this.currentWorker++ % this.workerCount].addChannel(entry);
>  >
>  > Is this safe? Since currentWorker will eventually wrap around to a
>  > negative number. It will take a while, a long long while, but I don't
>  > notice any resets anywhere, so I assume after running for a few
>  > months, or under extremely high volume it will eventually fail.
>  >
>
>
> I do not think it is unsafe given the fact we are only interested in
>  more or less equal distribution of new connections among existing
>  workers, but I agree it would be nice to have the count wrap around to
>  1.
>
>  We happily take patches ;-)
>
>
>  > PS: Of all the open source projects' source code I've worked with,
>  > HttpComponents have been the biggest pleasure of all. The code is
>  > very... "intelligable". Sometimes code is over "complexified", or made
>  > so abstract that one cannot see how things link up with each other, or
>  > just badly written. Thanks for it all!
>  >
>
>
> I am glad you found source code comprehensible. I hope it is useful too.
>
>  Cheers
>
>
>  Oleg
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>  For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Quintin Beukes

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message