Workaround for JDK NIO bug. See #203

This commit is contained in:
Norman Maurer 2012-02-28 14:24:27 +01:00
parent 1bc988f17c
commit 5a97e53f68

View File

@ -28,6 +28,24 @@ final class SelectorUtil {
static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors() * 2; static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors() * 2;
// Workaround for JDK NIO bug.
//
// See:
// - http://bugs.sun.com/view_bug.do?bug_id=6427854
// - https://github.com/netty/netty/issues/203
static {
String key = "sun.nio.ch.bugLevel";
try {
String buglevel = System.getProperty(key);
if (buglevel == null) {
System.setProperty(key, "");
}
} catch (SecurityException e) {
if (logger.isDebugEnabled()) {
logger.debug("Unable to get/set System Property '" + key + "'", e);
}
}
}
static void select(Selector selector) throws IOException { static void select(Selector selector) throws IOException {
try { try {
selector.select(10); selector.select(10);