Hi,
You maybe mean not "(roundRobinCounter++) & 0xFFFFFFFF" but "(roundRobinCounter++) & 0x7FFFFFFF" because 0x80000000 is Integer.MIN_VALUE. It means -2147483648.
Is it right?
Then,
RoundRobinSelectorHandler#nextController()
---
private ReadController nextController() {
return rrControllers[((roundRobinCounter++) & 0x7FFFFFFF) % rrControllers.length];
}
---
I like it, too.
Thanks.
--
Bongjae Chang
----- Original Message -----
From: rama
To: dev_at_grizzly.dev.java.net
Sent: Wednesday, May 13, 2009 4:39 PM
Subject: Re: (Trivial) RoundRobinSelectorHandler's roundRobinCounter
isn't better to use something like?
private ReadController nextController() {
return rrControllers[((roundRobinCounter++) & 0xFFFFFFFF)% rrControllers.length];
}
--------
RoundRobinSelectorHandler#nextController()
---
private ReadController nextController() {
int index = roundRobinCounter++ % rrControllers.length;
if( roundRobinCounter < 0 )
roundRobinCounter = 0;
return rrControllers[index];
}
---
Thanks.
--
Bongjae Chang