Class MemoryPoolMXBeanImpl
- All Implemented Interfaces:
MemoryPoolMXBean, MemoryPoolMXBean, PlatformManagedObject
-
Method Summary
Modifier and TypeMethodDescriptionReturns the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool.longReturns the collection usage threshold value of this memory pool in bytes.longReturns the number of times that the Java virtual machine has detected that the memory usage has reached or exceeded the collection usage threshold.String[]Returns the name of memory managers that manages this memory pool.getName()Returns the name representing this memory pool.Returns anObjectNameinstance representing the object name of this platform managed object.Returns the peak memory usage of this memory pool since the Java virtual machine was started or since the peak was reset.To satisfy com.ibm.lang.management.MemoryPoolMXBean.getType()Returns the type of this memory pool.getUsage()Returns an estimate of the memory usage of this memory pool.longReturns the usage threshold value of this memory pool in bytes.longReturns the number of times that the memory usage has crossed the usage threshold.booleanTests if the memory usage of this memory pool after the most recent collection on which the Java virtual machine has expended effort has reached or exceeded its collection usage threshold.booleanTests if this memory pool supports a collection usage threshold.booleanTests if the memory usage of this memory pool reaches or exceeds its usage threshold value.booleanTests if this memory pool supports usage threshold.booleanisValid()Tests if this memory pool is valid in the Java virtual machine.voidResets the peak memory usage statistic of this memory pool to the current memory usage.voidsetCollectionUsageThreshold(long threshold) Sets the collection usage threshold of this memory pool to the giventhresholdvalue.voidsetUsageThreshold(long threshold) Sets the threshold of this memory pool to the giventhresholdvalue if this memory pool supports the usage threshold.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface MemoryPoolMXBean
getPreCollectionUsageModifier and TypeMethodDescriptionIf supported by the virtual machine, returns aMemoryUsagewhich encapsulates this memory pool's memory usage before the most recent run of the garbage collector.
-
Method Details
-
getCollectionUsage
Returns the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool. This method does not request the Java virtual machine to perform any garbage collection other than its normal automatic memory management. This method returnsnullif the Java virtual machine does not support this method.MBeanServer access:
The mapped type ofMemoryUsageisCompositeDatawith attributes as specified inMemoryUsage.- Specified by:
getCollectionUsagein interfaceMemoryPoolMXBean- Returns:
- a
MemoryUsagerepresenting the memory usage of this memory pool after the Java virtual machine most recently expended effort in recycling unused objects;nullif this method is not supported.
-
getPreCollectionUsage
To satisfy com.ibm.lang.management.MemoryPoolMXBean.- Returns:
- a
MemoryUsagecontaining the usage details for the memory pool just before the most recent collection occurred. Returnsnullif the virtual machine does not support this method.
-
getCollectionUsageThreshold
public long getCollectionUsageThreshold()Returns the collection usage threshold value of this memory pool in bytes. The default value is zero. The collection usage threshold can be changed via thesetCollectionUsageThresholdmethod.- Specified by:
getCollectionUsageThresholdin interfaceMemoryPoolMXBean- Returns:
- the collection usage threshold of this memory pool in bytes.
- See Also:
-
getCollectionUsageThresholdCount
public long getCollectionUsageThresholdCount()Returns the number of times that the Java virtual machine has detected that the memory usage has reached or exceeded the collection usage threshold.- Specified by:
getCollectionUsageThresholdCountin interfaceMemoryPoolMXBean- Returns:
- the number of times that the memory usage has reached or exceeded the collection usage threshold.
- See Also:
-
getMemoryManagerNames
Returns the name of memory managers that manages this memory pool. Each memory pool will be managed by at least one memory manager.- Specified by:
getMemoryManagerNamesin interfaceMemoryPoolMXBean- Returns:
- an array of
Stringobjects, each is the name of a memory manager managing this memory pool.
-
getName
Returns the name representing this memory pool.- Specified by:
getNamein interfaceMemoryPoolMXBean- Returns:
- the name of this memory pool.
-
getPeakUsage
Returns the peak memory usage of this memory pool since the Java virtual machine was started or since the peak was reset. This method returnsnullif this memory pool is not valid (i.e. no longer exists).MBeanServer access:
The mapped type ofMemoryUsageisCompositeDatawith attributes as specified inMemoryUsage.- Specified by:
getPeakUsagein interfaceMemoryPoolMXBean- Returns:
- a
MemoryUsageobject representing the peak memory usage; ornullif this pool is not valid.
-
getType
Returns the type of this memory pool.MBeanServer access:
The mapped type ofMemoryTypeisStringand the value is the name of theMemoryType.- Specified by:
getTypein interfaceMemoryPoolMXBean- Returns:
- the type of this memory pool.
-
getUsage
Returns an estimate of the memory usage of this memory pool. This method returnsnullif this memory pool is not valid (i.e. no longer exists).This method requests the Java virtual machine to make a best-effort estimate of the current memory usage of this memory pool. For some memory pools, this method may be an expensive operation that requires some computation to determine the estimate. An implementation should document when this is the case.
This method is designed for use in monitoring system memory usage and detecting low memory condition.
MBeanServer access:
The mapped type ofMemoryUsageisCompositeDatawith attributes as specified inMemoryUsage.- Specified by:
getUsagein interfaceMemoryPoolMXBean- Returns:
- a
MemoryUsageobject; ornullif this pool not valid.
-
getUsageThreshold
public long getUsageThreshold()Returns the usage threshold value of this memory pool in bytes. Each memory pool has a platform-dependent default threshold value. The current usage threshold can be changed via thesetUsageThresholdmethod.- Specified by:
getUsageThresholdin interfaceMemoryPoolMXBean- Returns:
- the usage threshold value of this memory pool in bytes.
- See Also:
-
getUsageThresholdCount
public long getUsageThresholdCount()Returns the number of times that the memory usage has crossed the usage threshold.- Specified by:
getUsageThresholdCountin interfaceMemoryPoolMXBean- Returns:
- the number of times that the memory usage has crossed its usage threshold value.
-
isCollectionUsageThresholdExceeded
public boolean isCollectionUsageThresholdExceeded()Tests if the memory usage of this memory pool after the most recent collection on which the Java virtual machine has expended effort has reached or exceeded its collection usage threshold. This method does not request the Java virtual machine to perform any garbage collection other than its normal automatic memory management.- Specified by:
isCollectionUsageThresholdExceededin interfaceMemoryPoolMXBean- Returns:
trueif the memory usage of this memory pool reaches or exceeds the collection usage threshold value in the most recent collection;falseotherwise.
-
isCollectionUsageThresholdSupported
public boolean isCollectionUsageThresholdSupported()Tests if this memory pool supports a collection usage threshold.- Specified by:
isCollectionUsageThresholdSupportedin interfaceMemoryPoolMXBean- Returns:
trueif this memory pool supports the collection usage threshold;falseotherwise.
-
isUsageThresholdExceeded
public boolean isUsageThresholdExceeded()Tests if the memory usage of this memory pool reaches or exceeds its usage threshold value.- Specified by:
isUsageThresholdExceededin interfaceMemoryPoolMXBean- Returns:
trueif the memory usage of this memory pool reaches or exceeds the threshold value;falseotherwise.
-
isUsageThresholdSupported
public boolean isUsageThresholdSupported()Tests if this memory pool supports usage threshold.- Specified by:
isUsageThresholdSupportedin interfaceMemoryPoolMXBean- Returns:
trueif this memory pool supports usage threshold;falseotherwise.
-
isValid
public boolean isValid()Tests if this memory pool is valid in the Java virtual machine. A memory pool becomes invalid once the Java virtual machine removes it from the memory system.- Specified by:
isValidin interfaceMemoryPoolMXBean- Returns:
trueif the memory pool is valid in the running Java virtual machine;falseotherwise.
-
resetPeakUsage
public void resetPeakUsage()Resets the peak memory usage statistic of this memory pool to the current memory usage.- Specified by:
resetPeakUsagein interfaceMemoryPoolMXBean
-
setCollectionUsageThreshold
public void setCollectionUsageThreshold(long threshold) Sets the collection usage threshold of this memory pool to the giventhresholdvalue. When this threshold is set to positive, the Java virtual machine will check the memory usage at its best appropriate time after it has expended effort in recycling unused objects in this memory pool.The collection usage threshold crossing checking is enabled in this memory pool if the threshold is set to a positive value. The collection usage threshold crossing checking is disabled if it is set to zero.
- Specified by:
setCollectionUsageThresholdin interfaceMemoryPoolMXBean- Parameters:
threshold- the new collection usage threshold value in bytes. Must be non-negative.- See Also:
-
setUsageThreshold
public void setUsageThreshold(long threshold) Sets the threshold of this memory pool to the giventhresholdvalue if this memory pool supports the usage threshold. The usage threshold crossing checking is enabled in this memory pool if the threshold is set to a positive value. The usage threshold crossing checking is disabled if it is set to zero.- Specified by:
setUsageThresholdin interfaceMemoryPoolMXBean- Parameters:
threshold- the new threshold value in bytes. Must be non-negative.- See Also:
-
getObjectName
Returns anObjectNameinstance representing the object name of this platform managed object.- Specified by:
getObjectNamein interfacePlatformManagedObject- Returns:
- an
ObjectNameinstance representing the object name of this platform managed object.
-