460210 - ExecutionStragegy producer for SelectManager calls onOpen from produce method

fixed NPE on connection destroy for stopped selector
This commit is contained in:
Greg Wilkins 2015-02-19 14:30:39 +11:00
parent e83549f4b4
commit c4a49110ef
1 changed files with 8 additions and 3 deletions

View File

@ -120,7 +120,8 @@ public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dump
_actions.offer(change); _actions.offer(change);
if (_selecting) if (_selecting)
{ {
_selector.wakeup(); if (_selector!=null)
_selector.wakeup();
// To avoid the extra select wakeup. // To avoid the extra select wakeup.
_selecting=false; _selecting=false;
} }
@ -708,8 +709,12 @@ public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dump
@Override @Override
public void run() public void run()
{ {
Selector selector=_selector; Selector selector;
_selector=null; try(SpinLock.Lock lock = _lock.lock())
{
selector=_selector;
_selector=null;
}
closeNoExceptions(selector); closeNoExceptions(selector);
_latch.countDown(); _latch.countDown();
} }