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:
Simone Bordet 2012-01-17 23:00:34 +01:00
parent c0d3266c59
commit 6e38a97d7f
1 changed files with 6 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
@ -969,8 +970,9 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
public void dumpKeyState(List<Object> dumpto)
{
Selector selector=_selector;
dumpto.add(selector+" keys="+selector.keys().size());
for (SelectionKey key: selector.keys())
Set<SelectionKey> keys = selector.keys();
dumpto.add(selector + " keys=" + keys.size());
for (SelectionKey key: keys)
{
if (key.isValid())
dumpto.add(key.attachment()+" iOps="+key.interestOps()+" rOps="+key.readyOps());