Issue #2755 - ManagedSelector 100% CPU spin.
Added check for thread interrupted. If interrupted and ManagedSelector is not running, bail out. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
0ba1d9b5a5
commit
a090741a60
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.nio.channels.CancelledKeyException;
|
import java.nio.channels.CancelledKeyException;
|
||||||
|
import java.nio.channels.ClosedSelectorException;
|
||||||
import java.nio.channels.SelectableChannel;
|
import java.nio.channels.SelectableChannel;
|
||||||
import java.nio.channels.SelectionKey;
|
import java.nio.channels.SelectionKey;
|
||||||
import java.nio.channels.Selector;
|
import java.nio.channels.Selector;
|
||||||
|
@ -426,6 +427,9 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Selector {} woken up from select, {}/{}/{} selected", selector, selected, selector.selectedKeys().size(), selector.keys().size());
|
LOG.debug("Selector {} woken up from select, {}/{}/{} selected", selector, selected, selector.selectedKeys().size(), selector.keys().size());
|
||||||
|
|
||||||
|
if (Thread.interrupted() && !isRunning())
|
||||||
|
throw new ClosedSelectorException();
|
||||||
|
|
||||||
int updates;
|
int updates;
|
||||||
synchronized(ManagedSelector.this)
|
synchronized(ManagedSelector.this)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue