Sure.

Was no bother. Just something that caught my attention when looking
around for connection management. Besides, you need so many requests
for it to throw a BufferUnderflowException, that it's very unlikely to
happen. One would probably restart your Linux server before this ever
happens.

Q

On 6/23/08, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> On Mon, 2008-06-23 at 20:13 +0200, Quintin Beukes wrote:
>  > 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);
>  >
>
>
> I would not like to over-synchronize just to have a pretty worker count.
>  and would just leave this bit of code as is. The worker count as well as
>  the new channel distribution do not really need to be very precise.
>
>  Can you live with that?
>
>
>  Oleg
>
>
>
>  > On 6/23/08, Oleg Kalnichevski <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>  > >  For additional commands, e-mail: [EMAIL PROTECTED]
>  > >
>  > >
>  >
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Quintin Beukes

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to