Search in sources :

Example 6 with Cleaner

use of sun.misc.Cleaner in project orientdb by orientechnologies.

the class OByteBufferPool method findDirectByteBufferWithCleaner.

private static ByteBuffer findDirectByteBufferWithCleaner(ByteBuffer buffer, int depthLimit) {
    if (depthLimit == 0)
        return null;
    if (!(buffer instanceof DirectBuffer))
        return null;
    final DirectBuffer directBuffer = (DirectBuffer) buffer;
    final Cleaner cleaner = directBuffer.cleaner();
    if (cleaner != null)
        return buffer;
    final Object attachment = directBuffer.attachment();
    if (!(attachment instanceof ByteBuffer))
        return null;
    return findDirectByteBufferWithCleaner((ByteBuffer) attachment, depthLimit - 1);
}
Also used : DirectBuffer(sun.nio.ch.DirectBuffer) ByteBuffer(java.nio.ByteBuffer) Cleaner(sun.misc.Cleaner)

Aggregations

Cleaner (sun.misc.Cleaner)6 ByteBuffer (java.nio.ByteBuffer)3 Field (java.lang.reflect.Field)2 DirectBuffer (sun.nio.ch.DirectBuffer)2 Constructor (java.lang.reflect.Constructor)1 MappedByteBuffer (java.nio.MappedByteBuffer)1