Fixed race where the key interests were set before updating the
state, causing onSelected() to be called with the wrong state and failing an assertion.
This commit is contained in:
parent
8d2efaf7eb
commit
bcbefd3942
|
@ -148,9 +148,11 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
|||
case UPDATING:
|
||||
{
|
||||
// Set the key interest as expected.
|
||||
setKeyInterests();
|
||||
if (!_interestState.compareAndSet(current, State.SELECTING))
|
||||
throw new IllegalStateException();
|
||||
// Set the key interests after updating the state, otherwise
|
||||
// the selector may select and call onSelected() concurrently.
|
||||
setKeyInterests();
|
||||
return;
|
||||
}
|
||||
case CHANGING:
|
||||
|
|
Loading…
Reference in New Issue