Class MemoryPoolMXBeanImpl

java.lang.Object
com.ibm.lang.management.internal.MemoryPoolMXBeanImpl
All Implemented Interfaces:
MemoryPoolMXBean, MemoryPoolMXBean, PlatformManagedObject

public final class MemoryPoolMXBeanImpl extends Object implements MemoryPoolMXBean
Implementation of the extended MemoryPoolMXBean.
  • Method Details

    • getCollectionUsage

      public MemoryUsage 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 returns null if the Java virtual machine does not support this method.

      MBeanServer access:
      The mapped type of MemoryUsage is CompositeData with attributes as specified in MemoryUsage.

      Specified by:
      getCollectionUsage in interface MemoryPoolMXBean
      Returns:
      a MemoryUsage representing the memory usage of this memory pool after the Java virtual machine most recently expended effort in recycling unused objects; null if this method is not supported.
    • getPreCollectionUsage

      public MemoryUsage getPreCollectionUsage()
      To satisfy com.ibm.lang.management.MemoryPoolMXBean.
      Returns:
      a MemoryUsage containing the usage details for the memory pool just before the most recent collection occurred. Returns null if 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 the setCollectionUsageThreshold method.
      Specified by:
      getCollectionUsageThreshold in interface MemoryPoolMXBean
      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:
      getCollectionUsageThresholdCount in interface MemoryPoolMXBean
      Returns:
      the number of times that the memory usage has reached or exceeded the collection usage threshold.
      See Also:
    • getMemoryManagerNames

      public String[] 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:
      getMemoryManagerNames in interface MemoryPoolMXBean
      Returns:
      an array of String objects, each is the name of a memory manager managing this memory pool.
    • getName

      public String getName()
      Returns the name representing this memory pool.
      Specified by:
      getName in interface MemoryPoolMXBean
      Returns:
      the name of this memory pool.
    • getPeakUsage

      public MemoryUsage 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 returns null if this memory pool is not valid (i.e. no longer exists).

      MBeanServer access:
      The mapped type of MemoryUsage is CompositeData with attributes as specified in MemoryUsage.

      Specified by:
      getPeakUsage in interface MemoryPoolMXBean
      Returns:
      a MemoryUsage object representing the peak memory usage; or null if this pool is not valid.
    • getType

      public MemoryType getType()
      Returns the type of this memory pool.

      MBeanServer access:
      The mapped type of MemoryType is String and the value is the name of the MemoryType.

      Specified by:
      getType in interface MemoryPoolMXBean
      Returns:
      the type of this memory pool.
    • getUsage

      public MemoryUsage getUsage()
      Returns an estimate of the memory usage of this memory pool. This method returns null if 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 of MemoryUsage is CompositeData with attributes as specified in MemoryUsage.

      Specified by:
      getUsage in interface MemoryPoolMXBean
      Returns:
      a MemoryUsage object; or null if 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 the setUsageThreshold method.
      Specified by:
      getUsageThreshold in interface MemoryPoolMXBean
      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:
      getUsageThresholdCount in interface MemoryPoolMXBean
      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:
      isCollectionUsageThresholdExceeded in interface MemoryPoolMXBean
      Returns:
      true if the memory usage of this memory pool reaches or exceeds the collection usage threshold value in the most recent collection; false otherwise.
    • isCollectionUsageThresholdSupported

      public boolean isCollectionUsageThresholdSupported()
      Tests if this memory pool supports a collection usage threshold.
      Specified by:
      isCollectionUsageThresholdSupported in interface MemoryPoolMXBean
      Returns:
      true if this memory pool supports the collection usage threshold; false otherwise.
    • isUsageThresholdExceeded

      public boolean isUsageThresholdExceeded()
      Tests if the memory usage of this memory pool reaches or exceeds its usage threshold value.
      Specified by:
      isUsageThresholdExceeded in interface MemoryPoolMXBean
      Returns:
      true if the memory usage of this memory pool reaches or exceeds the threshold value; false otherwise.
    • isUsageThresholdSupported

      public boolean isUsageThresholdSupported()
      Tests if this memory pool supports usage threshold.
      Specified by:
      isUsageThresholdSupported in interface MemoryPoolMXBean
      Returns:
      true if this memory pool supports usage threshold; false otherwise.
    • 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:
      isValid in interface MemoryPoolMXBean
      Returns:
      true if the memory pool is valid in the running Java virtual machine; false otherwise.
    • resetPeakUsage

      public void resetPeakUsage()
      Resets the peak memory usage statistic of this memory pool to the current memory usage.
      Specified by:
      resetPeakUsage in interface MemoryPoolMXBean
    • setCollectionUsageThreshold

      public void setCollectionUsageThreshold(long threshold)
      Sets the collection usage threshold of this memory pool to the given threshold value. 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:
      setCollectionUsageThreshold in interface MemoryPoolMXBean
      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 given threshold value 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:
      setUsageThreshold in interface MemoryPoolMXBean
      Parameters:
      threshold - the new threshold value in bytes. Must be non-negative.
      See Also:
    • getObjectName

      public ObjectName getObjectName()
      Returns an ObjectName instance representing the object name of this platform managed object.
      Specified by:
      getObjectName in interface PlatformManagedObject
      Returns:
      an ObjectName instance representing the object name of this platform managed object.