This is taken from Hadoop at https://issues.apache.org/jira/browse/HADOOP-12760 and
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/CleanerUtil.java
Unfortunately this is not available in some general utility library yet, but hopefully will be at some point.
sun.misc.Cleaner has moved in OpenJDK 9 and
sun.misc.Unsafe#invokeCleaner(ByteBuffer) is the replacement.
This class is a hack to use sun.misc.Cleaner in Java 8 and
use the replacement in Java 9+.
This implementation is inspired by LUCENE-6989.
org.apache.poi.poifs.nio
back to summary
public Interface CleanerUtil.BufferCleaner
- Annotations
- @FunctionalInterface
Pass in an implementation of this interface to cleanup ByteBuffers.
CleanerUtil implements this to allow unmapping of bytebuffers
with private Java APIs.
Method Summary
| Modifier and Type | Method and Description
|
|---|
| public void |
|