360546 handle set count exceeding max integer

This commit is contained in:
Greg Wilkins 2011-10-28 15:04:49 +11:00
parent 962e4afda9
commit afc358972a
1 changed files with 7 additions and 1 deletions

View File

@ -63,7 +63,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
private long _lowResourcesConnections;
private SelectSet[] _selectSet;
private int _selectSets=1;
private volatile int _set;
private volatile int _set=0;
private boolean _deferringInterestedOps0=true;
private int _selectorPriorityDelta=0;
@ -128,6 +128,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
// be distributed over the available sets.
int s=_set++;
if (s<0)
s=-s;
s=s%_selectSets;
SelectSet[] sets=_selectSet;
if (sets!=null)
@ -150,6 +152,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
// be distributed over the available sets.
int s=_set++;
if (s<0)
s=-s;
s=s%_selectSets;
SelectSet[] sets=_selectSet;
if (sets!=null)
@ -167,6 +171,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
public void register(ServerSocketChannel acceptChannel)
{
int s=_set++;
if (s<0)
s=-s;
s=s%_selectSets;
SelectSet set=_selectSet[s];
set.addChange(acceptChannel);