boolean (@Nullable Object value) { if (value == null) { return true; } if (value instanceof ByteBuffer) { //every BBuffer we meet could be a mapped buffer, which was already unmapped by one of the .closeXXX() // methods before -- so don't touch it even with a stick. // Even set.contains(byteBuffer) could crash JVM: it calls value.hashCode() which for // ByteBuffer scans through its content return true; } if (value instanceof FilePageCacheLockFree) { //don't close app-global cache return true; } //just a few most frequently met types that 100% not worth to dive into if (value instanceof Number || value instanceof Path || value instanceof File || value instanceof Map || value instanceof Lock || value instanceof ReadWriteLock || value instanceof Executor || value instanceof java.util.logging.Logger || value instanceof com.intellij.openapi.diagnostic.Logger || value instanceof Condition) { return true; } if (value.getClass().getPackageName().startsWith("io.opentelemetry")) { //don't mess with ITel internals return true; } if (value.getClass().equals(Object.class)) {//no harm, but useless return true; } return false; }