public class BufferPool
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BufferPool.LocalPool
A thread local class that grabs chunks from the global pool for this thread allocations.
|
Modifier and Type | Field and Description |
---|---|
static long |
MEMORY_USAGE_THRESHOLD |
static int |
NORMAL_ALLOCATION_UNIT |
static int |
NORMAL_CHUNK_SIZE
The size of a page aligned buffer, 128KiB
|
static int |
TINY_ALLOCATION_LIMIT |
static int |
TINY_ALLOCATION_UNIT |
static int |
TINY_CHUNK_SIZE |
Constructor and Description |
---|
BufferPool() |
Modifier and Type | Method and Description |
---|---|
static void |
debug(org.apache.cassandra.utils.memory.BufferPool.Debug setDebug) |
static java.nio.ByteBuffer |
get(int size,
BufferType bufferType) |
static java.nio.ByteBuffer |
getAtLeast(int size,
BufferType bufferType) |
static void |
put(java.nio.ByteBuffer buffer) |
static void |
putUnusedPortion(java.nio.ByteBuffer buffer) |
static int |
roundUp(int size) |
static int |
roundUp(int size,
int unit) |
static void |
setRecycleWhenFreeForCurrentThread(boolean recycleWhenFree) |
static void |
shutdownLocalCleaner(long timeout,
java.util.concurrent.TimeUnit unit) |
static long |
sizeInBytes() |
static java.nio.ByteBuffer |
tryGet(int size)
Unlike the get methods, this will return null if the pool is exhausted
|
static java.nio.ByteBuffer |
tryGetAtLeast(int size) |
static long |
unsafeGetBytesInUse() |
public static final int NORMAL_CHUNK_SIZE
public static final int NORMAL_ALLOCATION_UNIT
public static final int TINY_CHUNK_SIZE
public static final int TINY_ALLOCATION_UNIT
public static final int TINY_ALLOCATION_LIMIT
public static long MEMORY_USAGE_THRESHOLD
public static java.nio.ByteBuffer get(int size, BufferType bufferType)
public static java.nio.ByteBuffer getAtLeast(int size, BufferType bufferType)
public static java.nio.ByteBuffer tryGet(int size)
public static java.nio.ByteBuffer tryGetAtLeast(int size)
public static void put(java.nio.ByteBuffer buffer)
public static void putUnusedPortion(java.nio.ByteBuffer buffer)
public static void setRecycleWhenFreeForCurrentThread(boolean recycleWhenFree)
public static long sizeInBytes()
public static void debug(org.apache.cassandra.utils.memory.BufferPool.Debug setDebug)
public static int roundUp(int size)
public static int roundUp(int size, int unit)
public static void shutdownLocalCleaner(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
java.util.concurrent.TimeoutException
public static long unsafeGetBytesInUse()
Copyright © 2009-2020 The Apache Software Foundation