415062 SelectorManager wakeup optimisation
Some further cleanup after sbordet review
This commit is contained in:
parent
70e7a69d19
commit
b58c05d77c
|
@ -366,12 +366,11 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
if (_thread==Thread.currentThread())
|
if (_thread==Thread.currentThread())
|
||||||
{
|
{
|
||||||
// If we are already iterating over the changes, just add this change to the list.
|
// If we are already iterating over the changes, just add this change to the list.
|
||||||
// No race here because it is this thread that is iterating over the changes.
|
if (_state.get()==SelectorState.CHANGING)
|
||||||
if (_state.compareAndSet(SelectorState.CHANGING,SelectorState.MORE_CHANGES))
|
|
||||||
_changes.offer(change);
|
_changes.offer(change);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Otherwise we run the queued changes
|
// Otherwise we run the queued changes, list should mostly be empty
|
||||||
runChanges();
|
runChanges();
|
||||||
// and then directly run the passed change
|
// and then directly run the passed change
|
||||||
runChange(change);
|
runChange(change);
|
||||||
|
|
Loading…
Reference in New Issue