< prev index next >
src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java
Print this page
*** 35,51 ****
* implementing this interface is
* an <a href="ManagementFactory.html#MXBean">MXBean</a>
* that can be obtained by calling
* the {@link ManagementFactory#getMemoryPoolMXBeans} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
! * platform <tt>MBeanServer</tt>} method.
*
! * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
! * a memory pool within an <tt>MBeanServer</tt> is:
* <blockquote>
* {@link ManagementFactory#MEMORY_POOL_MXBEAN_DOMAIN_TYPE
! * <tt>java.lang:type=MemoryPool</tt>}<tt>,name=</tt><i>pool's name</i>
* </blockquote>
*
* It can be obtained by calling the
* {@link PlatformManagedObject#getObjectName} method.
*
--- 35,51 ----
* implementing this interface is
* an <a href="ManagementFactory.html#MXBean">MXBean</a>
* that can be obtained by calling
* the {@link ManagementFactory#getMemoryPoolMXBeans} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
! * platform MBeanServer} method.
*
! * <p>The {@code ObjectName} for uniquely identifying the MXBean for
! * a memory pool within an {@code MBeanServer} is:
* <blockquote>
* {@link ManagementFactory#MEMORY_POOL_MXBEAN_DOMAIN_TYPE
! * java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i>
* </blockquote>
*
* It can be obtained by calling the
* {@link PlatformManagedObject#getObjectName} method.
*
*** 234,244 ****
* <li><a name="ThresholdNotification"><b>Usage Threshold Notifications</b></a>
* <p>
* Usage threshold notification will be emitted by {@link MemoryMXBean}.
* When the Java virtual machine detects that the memory usage of
* a memory pool has reached or exceeded the usage threshold
! * the virtual machine will trigger the <tt>MemoryMXBean</tt> to emit an
* {@link MemoryNotificationInfo#MEMORY_THRESHOLD_EXCEEDED
* usage threshold exceeded notification}.
* Another usage threshold exceeded notification will not be
* generated until the usage has fallen below the threshold and
* then exceeded it again.
--- 234,244 ----
* <li><a name="ThresholdNotification"><b>Usage Threshold Notifications</b></a>
* <p>
* Usage threshold notification will be emitted by {@link MemoryMXBean}.
* When the Java virtual machine detects that the memory usage of
* a memory pool has reached or exceeded the usage threshold
! * the virtual machine will trigger the {@code MemoryMXBean} to emit an
* {@link MemoryNotificationInfo#MEMORY_THRESHOLD_EXCEEDED
* usage threshold exceeded notification}.
* Another usage threshold exceeded notification will not be
* generated until the usage has fallen below the threshold and
* then exceeded it again.
*** 248,258 ****
* mechanism to detect low memory conditions instead of polling.
* In this example code, upon receiving notification, the notification
* listener notifies another thread to perform the actual action
* such as to redistribute outstanding tasks, stop receiving tasks,
* or resume receiving tasks.
! * The <tt>handleNotification</tt> method should be designed to
* do a very minimal amount of work and return without delay to avoid
* causing delay in delivering subsequent notifications. Time-consuming
* actions should be performed by a separate thread.
* The notification listener may be invoked by multiple threads
* concurrently; so the tasks performed by the listener
--- 248,258 ----
* mechanism to detect low memory conditions instead of polling.
* In this example code, upon receiving notification, the notification
* listener notifies another thread to perform the actual action
* such as to redistribute outstanding tasks, stop receiving tasks,
* or resume receiving tasks.
! * The {@code handleNotification} method should be designed to
* do a very minimal amount of work and return without delay to avoid
* causing delay in delivering subsequent notifications. Time-consuming
* actions should be performed by a separate thread.
* The notification listener may be invoked by multiple threads
* concurrently; so the tasks performed by the listener
*** 288,298 ****
* ....
*
* </pre>
* <hr>
* <p>
! * There is no guarantee about when the <tt>MemoryMXBean</tt> will emit
* a threshold notification and when the notification will be delivered.
* When a notification listener is invoked, the memory usage of
* the memory pool may have crossed the usage threshold more
* than once.
* The {@link MemoryNotificationInfo#getCount} method returns the number
--- 288,298 ----
* ....
*
* </pre>
* <hr>
* <p>
! * There is no guarantee about when the {@code MemoryMXBean} will emit
* a threshold notification and when the notification will be delivered.
* When a notification listener is invoked, the memory usage of
* the memory pool may have crossed the usage threshold more
* than once.
* The {@link MemoryNotificationInfo#getCount} method returns the number
*** 372,391 ****
/**
* Returns the type of this memory pool.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of <tt>MemoryType</tt> is <tt>String</tt>
! * and the value is the name of the <tt>MemoryType</tt>.
*
* @return the type of this memory pool.
*/
public MemoryType getType();
/**
* Returns an estimate of the memory usage of this memory pool.
! * This method returns <tt>null</tt>
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
* This method requests the Java virtual machine to make
* a best-effort estimate of the current memory usage of this
--- 372,391 ----
/**
* Returns the type of this memory pool.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of {@code MemoryType} is {@code String}
! * and the value is the name of the {@code MemoryType}.
*
* @return the type of this memory pool.
*/
public MemoryType getType();
/**
* Returns an estimate of the memory usage of this memory pool.
! * This method returns {@code null}
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
* This method requests the Java virtual machine to make
* a best-effort estimate of the current memory usage of this
*** 397,429 ****
* <p>This method is designed for use in monitoring system
* memory usage and detecting low memory condition.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of <tt>MemoryUsage</tt> is
! * <tt>CompositeData</tt> with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
! * @return a {@link MemoryUsage} object; or <tt>null</tt> if
* this pool not valid.
*/
public MemoryUsage getUsage();
/**
* 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 <tt>null</tt>
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of <tt>MemoryUsage</tt> is
! * <tt>CompositeData</tt> with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} object representing the peak
! * memory usage; or <tt>null</tt> if this pool is not valid.
*
*/
public MemoryUsage getPeakUsage();
/**
--- 397,429 ----
* <p>This method is designed for use in monitoring system
* memory usage and detecting low memory condition.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of {@code MemoryUsage} is
! * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
! * @return a {@link MemoryUsage} object; or {@code null} if
* this pool not valid.
*/
public MemoryUsage getUsage();
/**
* 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 {@code null}
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of {@code MemoryUsage} is
! * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} object representing the peak
! * memory usage; or {@code null} if this pool is not valid.
*
*/
public MemoryUsage getPeakUsage();
/**
*** 439,459 ****
/**
* 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.
*
! * @return <tt>true</tt> if the memory pool is valid in the running
* Java virtual machine;
! * <tt>false</tt> otherwise.
*/
public boolean isValid();
/**
* Returns the name of memory managers that manages this memory pool.
* Each memory pool will be managed by at least one memory manager.
*
! * @return an array of <tt>String</tt> objects, each is the name of
* a memory manager managing this memory pool.
*/
public String[] getMemoryManagerNames();
/**
--- 439,459 ----
/**
* 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.
*
! * @return {@code true} if the memory pool is valid in the running
* Java virtual machine;
! * {@code false} otherwise.
*/
public boolean isValid();
/**
* Returns the name of memory managers that manages this memory pool.
* Each memory pool will be managed by at least one memory manager.
*
! * @return an array of {@code String} objects, each is the name of
* a memory manager managing this memory pool.
*/
public String[] getMemoryManagerNames();
/**
*** 470,489 ****
* @see #isUsageThresholdSupported
*/
public long getUsageThreshold();
/**
! * Sets the threshold of this memory pool to the given <tt>threshold</tt>
* 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.
*
* @param threshold the new threshold value in bytes. Must be non-negative.
*
! * @throws IllegalArgumentException if <tt>threshold</tt> is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
--- 470,489 ----
* @see #isUsageThresholdSupported
*/
public long getUsageThreshold();
/**
! * Sets the threshold of this memory pool to the given {@code 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.
*
* @param threshold the new threshold value in bytes. Must be non-negative.
*
! * @throws IllegalArgumentException if {@code threshold} is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
*** 499,511 ****
/**
* Tests if the memory usage of this memory pool
* reaches or exceeds its usage threshold value.
*
! * @return <tt>true</tt> if the memory usage of
* this memory pool reaches or exceeds the threshold value;
! * <tt>false</tt> otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
*/
public boolean isUsageThresholdExceeded();
--- 499,511 ----
/**
* Tests if the memory usage of this memory pool
* reaches or exceeds its usage threshold value.
*
! * @return {@code true} if the memory usage of
* this memory pool reaches or exceeds the threshold value;
! * {@code false} otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
*/
public boolean isUsageThresholdExceeded();
*** 523,534 ****
public long getUsageThresholdCount();
/**
* Tests if this memory pool supports usage threshold.
*
! * @return <tt>true</tt> if this memory pool supports usage threshold;
! * <tt>false</tt> otherwise.
*/
public boolean isUsageThresholdSupported();
/**
* Returns the collection usage threshold value of this memory pool
--- 523,534 ----
public long getUsageThresholdCount();
/**
* Tests if this memory pool supports usage threshold.
*
! * @return {@code true} if this memory pool supports usage threshold;
! * {@code false} otherwise.
*/
public boolean isUsageThresholdSupported();
/**
* Returns the collection usage threshold value of this memory pool
*** 545,555 ****
*/
public long getCollectionUsageThreshold();
/**
* Sets the collection usage threshold of this memory pool to
! * the given <tt>threshold</tt> 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.
* <p>
* The collection usage threshold crossing checking is enabled
--- 545,555 ----
*/
public long getCollectionUsageThreshold();
/**
* Sets the collection usage threshold of this memory pool to
! * the given {@code 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.
* <p>
* The collection usage threshold crossing checking is enabled
*** 558,568 ****
* if it is set to zero.
*
* @param threshold the new collection usage threshold value in bytes.
* Must be non-negative.
*
! * @throws IllegalArgumentException if <tt>threshold</tt> is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a collection usage threshold.
--- 558,568 ----
* if it is set to zero.
*
* @param threshold the new collection usage threshold value in bytes.
* Must be non-negative.
*
! * @throws IllegalArgumentException if {@code threshold} is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a collection usage threshold.
*** 583,596 ****
* 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.
*
! * @return <tt>true</tt> if the memory usage of this memory pool
* reaches or exceeds the collection usage threshold value
* in the most recent collection;
! * <tt>false</tt> otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
*/
public boolean isCollectionUsageThresholdExceeded();
--- 583,596 ----
* 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.
*
! * @return {@code true} if the memory usage of this memory pool
* reaches or exceeds the collection usage threshold value
* in the most recent collection;
! * {@code false} otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
*/
public boolean isCollectionUsageThresholdExceeded();
*** 615,643 ****
* 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 <tt>null</tt> if the Java virtual
* machine does not support this method.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of <tt>MemoryUsage</tt> is
! * <tt>CompositeData</tt> with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} representing the memory usage of
* this memory pool after the Java virtual machine most recently
* expended effort in recycling unused objects;
! * <tt>null</tt> if this method is not supported.
*/
public MemoryUsage getCollectionUsage();
/**
* Tests if this memory pool supports a collection usage threshold.
*
! * @return <tt>true</tt> if this memory pool supports the
! * collection usage threshold; <tt>false</tt> otherwise.
*/
public boolean isCollectionUsageThresholdSupported();
}
--- 615,643 ----
* 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 {@code null} if the Java virtual
* machine does not support this method.
*
* <p>
* <b>MBeanServer access</b>:<br>
! * The mapped type of {@code MemoryUsage} is
! * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} representing the memory usage of
* this memory pool after the Java virtual machine most recently
* expended effort in recycling unused objects;
! * {@code null} if this method is not supported.
*/
public MemoryUsage getCollectionUsage();
/**
* Tests if this memory pool supports a collection usage threshold.
*
! * @return {@code true} if this memory pool supports the
! * collection usage threshold; {@code false} otherwise.
*/
public boolean isCollectionUsageThresholdSupported();
}
< prev index next >