public final class OByteBufferPool extends Object implements OByteBufferPoolMXBean
DirectByteBuffer
objects
and pool for DirectByteBuffer
objects which were used and now are free to be reused
by other parts of the code. All DirectByteBuffer
objects have the same size which is
specified in objects constructor as "page size".ODirectMemoryAllocator
Constructor and Description |
---|
OByteBufferPool(int pageSize) |
OByteBufferPool(int pageSize,
ODirectMemoryAllocator allocator,
int poolSize) |
Modifier and Type | Method and Description |
---|---|
OPointer |
acquireDirect(boolean clear)
Acquires direct memory buffer with native byte order.
|
void |
checkMemoryLeaks()
Checks whether there are not released buffers in the pool
|
void |
clear()
Clears pool and dealocates memory.
|
int |
getPoolSize() |
static OByteBufferPool |
instance(OContextConfiguration contextConfiguration) |
void |
release(OPointer pointer)
Put buffer which is not used any more back to the pool or frees direct memory if pool is full.
|
public OByteBufferPool(int pageSize)
pageSize
- Size of single page (instance of DirectByteBuffer
) returned by
pool.public OByteBufferPool(int pageSize, ODirectMemoryAllocator allocator, int poolSize)
allocator
- Direct memory allocator to use.pageSize
- Size of single page (instance of DirectByteBuffer
) returned by
pool.poolSize
- Size of the page poolpublic static OByteBufferPool instance(OContextConfiguration contextConfiguration)
public final OPointer acquireDirect(boolean clear)
clear
- Whether returned buffer should be filled with zeros before return.public final void release(OPointer pointer)
pointer
- Not used instance of buffer.OGlobalConfiguration.DIRECT_MEMORY_POOL_LIMIT
public final int getPoolSize()
getPoolSize
in interface OByteBufferPoolMXBean
public void checkMemoryLeaks()
public void clear()
Copyright © 2009–2020 OrientDB. All rights reserved.