Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API.
The org.glassfish.grizzly.nio.DefaultSelectorHandler.force-selector-spin-detection JVM parameter defaults to false unless the OS is Linux and the JDK is 1.6 or lower. I propose that this be set to true on Linux regardless of the JDK version as the bug is still observed on 1.7 and higher if the kernel is an older version.
public static final boolean IS_WORKAROUND_SELECTOR_SPIN =
Boolean.getBoolean(DefaultSelectorHandler.class.getName() + ".force-selector-spin-detection") ||
System.getProperty("os.name").equalsIgnoreCase("linux");
// && JdkVersion.getJdkVersion().compareTo("1.7.0") < 0; <-- remove this check
Discussion about issue here - https://javaee.groups.io/g/grizzly/topic/5807706
The org.glassfish.grizzly.nio.DefaultSelectorHandler.force-selector-spin-detection JVM parameter defaults to false unless the OS is Linux and the JDK is 1.6 or lower. I propose that this be set to true on Linux regardless of the JDK version as the bug is still observed on 1.7 and higher if the kernel is an older version.