Skip to content

Instantly share code, notes, and snippets.

@pierre
Created July 22, 2011 22:35
Show Gist options
  • Save pierre/1100592 to your computer and use it in GitHub Desktop.
Save pierre/1100592 to your computer and use it in GitHub Desktop.
// Look for JVM bug
if (selected==0 && wait>0 && (now-before)<wait/2 && _selector.selectedKeys().size()==0)
{
if (_jvmBug++>5) // TODO tune or configure this
{
// Probably JVM BUG!
Iterator iter = _selector.keys().iterator();
while(iter.hasNext())
{
key = (SelectionKey) iter.next();
if (key.isValid()&&key.interestOps()==0)
{
key.cancel();
}
}
try
{
Thread.sleep(20); // tune or configure this
}
catch (InterruptedException e)
{
Log.ignore(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment