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);
}
Aggregations