Package io.deephaven.io
Class NioUtil
java.lang.Object
io.deephaven.io.NioUtil
General utilities for NIO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SelectorreduceSelectorGarbage(Selector selector) Use reflection to change the collection implementations so iteration operations used in the selector implementation will not produce garbage.
-
Constructor Details
-
NioUtil
public NioUtil()
-
-
Method Details
-
reduceSelectorGarbage
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.
-