When dumping the selector, we should take the keys only once, otherwise the set of keys may change between calls.
This commit is contained in:
parent
c0d3266c59
commit
6e38a97d7f
|
@ -24,6 +24,7 @@ import java.nio.channels.ServerSocketChannel;
|
||||||
import java.nio.channels.SocketChannel;
|
import java.nio.channels.SocketChannel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
@ -969,8 +970,9 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
public void dumpKeyState(List<Object> dumpto)
|
public void dumpKeyState(List<Object> dumpto)
|
||||||
{
|
{
|
||||||
Selector selector=_selector;
|
Selector selector=_selector;
|
||||||
dumpto.add(selector+" keys="+selector.keys().size());
|
Set<SelectionKey> keys = selector.keys();
|
||||||
for (SelectionKey key: selector.keys())
|
dumpto.add(selector + " keys=" + keys.size());
|
||||||
|
for (SelectionKey key: keys)
|
||||||
{
|
{
|
||||||
if (key.isValid())
|
if (key.isValid())
|
||||||
dumpto.add(key.attachment()+" iOps="+key.interestOps()+" rOps="+key.readyOps());
|
dumpto.add(key.attachment()+" iOps="+key.interestOps()+" rOps="+key.readyOps());
|
||||||
|
|
Loading…
Reference in New Issue