Package io.deephaven.io
Class NioUtil
- java.lang.Object
-
- io.deephaven.io.NioUtil
-
public class NioUtil extends java.lang.ObjectGeneral utilities for NIO
-
-
Constructor Summary
Constructors Constructor Description NioUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.channels.SelectorreduceSelectorGarbage(java.nio.channels.Selector selector)Use reflection to change the collection implementations so iteration operations used in the selector implementation will not produce garbage.
-
-
-
Method Detail
-
reduceSelectorGarbage
public static java.nio.channels.Selector reduceSelectorGarbage(java.nio.channels.Selector selector)
Use reflection to change the collection implementations so iteration operations used in the selector implementation will not produce garbage.This is only applied when the system property
java.specification.versionis equal to "1.8".We can do this because, by looking at the source code, we can tell that there are no simultaneous iterations so reusing one iterator is OK. Because of concurrent modification issues and thread safety issues, this is generally likely to be the case anyway. The implementation of selector is not likely to change between minor JDK revisions. A major JDK release might produce a rewrite, but in that case we can check the JDK version and apply the appropriate set of patches.
-
-