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
FieldsModifier and TypeFieldDescriptionprivate static final MBeanServerprivate static final booleanprivate static final org.slf4j.Loggerprivate static final longprivate static final Stringprivate static final ObjectName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddestroyDirectByteBuffer(ByteBuffer toBeDestroyed) DirectByteBuffers are garbage collected by using a phantom reference and a reference queue.static longReturns the direct memory limit of the current progressstatic longReturns the current amount of direct memory used.static longReturns 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.
-