Package org.apache.hadoop.hbase.util
Class DirectMemoryUtils
java.lang.Object
org.apache.hadoop.hbase.util.DirectMemoryUtils
Utilities for interacting with and monitoring DirectByteBuffer allocations.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final MBeanServer
private static final boolean
private static final org.slf4j.Logger
private static final long
private static final String
private static final ObjectName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
destroyDirectByteBuffer
(ByteBuffer toBeDestroyed) DirectByteBuffers are garbage collected by using a phantom reference and a reference queue.static long
Returns the direct memory limit of the current progressstatic long
Returns the current amount of direct memory used.static long
Returns the current amount of direct memory used by netty module.
-
Field Details
-
LOG
-
MEMORY_USED
- See Also:
-
BEAN_SERVER
-
NIO_DIRECT_POOL
-
HAS_MEMORY_USED_ATTRIBUTE
-
MAX_DIRECT_MEMORY
-
-
Constructor Details
-
DirectMemoryUtils
public DirectMemoryUtils()
-
-
Method Details
-
getDirectMemorySize
Returns the direct memory limit of the current progress -
getDirectMemoryUsage
Returns the current amount of direct memory used. -
getNettyDirectMemoryUsage
Returns the current amount of direct memory used by netty module. -
destroyDirectByteBuffer
public static void destroyDirectByteBuffer(ByteBuffer toBeDestroyed) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException DirectByteBuffers are garbage collected by using a phantom reference and a reference queue. Every once a while, the JVM checks the reference queue and cleans the DirectByteBuffers. However, as this doesn't happen immediately after discarding all references to a DirectByteBuffer, it's easy to OutOfMemoryError yourself using DirectByteBuffers. This function explicitly calls the Cleaner method of a DirectByteBuffer. The DirectByteBuffer that will be "cleaned". Utilizes reflection.
-