prevent spin by write blocked from non dispatched thread

This commit is contained in:
Greg Wilkins 2011-11-18 09:19:52 +11:00
parent 584bbd4bce
commit f70ed3ac21
2 changed files with 13 additions and 10 deletions

View File

@ -162,6 +162,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
// we are not interested in further selecting
_key.interestOps(0);
if (!_dispatched)
updateKey();
return;
}

View File

@ -585,15 +585,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
// Log and dump some status
_paused=true;
LOG.warn("Selector {} is too busy, pausing!",this);
final SelectSet set = this;
SelectorManager.this.dispatch(
new Runnable(){
public void run()
{
System.err.println(set+":\n"+set.dump());
}
public String toString() {return "Dump-"+super.toString();}
});
}
}
}
@ -991,6 +982,16 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
dumpto.add(key.attachment()+" - - ");
}
}
/* ------------------------------------------------------------ */
public String toString()
{
String s=super.toString()+" "+SelectorManager.this.getState();
Selector selector=_selector;
if (selector!=null && selector.isOpen())
s+=",k="+selector.keys().size()+",s="+selector.selectedKeys().size();
return s;
}
}
/* ------------------------------------------------------------ */