Workaround for JDK NIO bug. See #203
This commit is contained in:
parent
2b9df060dd
commit
19358ee246
@ -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(500);
|
selector.select(500);
|
||||||
|
Loading…
Reference in New Issue
Block a user