com.ibm.lang.management

Class MemoryMXBeanImpl

  1. java.lang.Object
  2. extended bycom.ibm.lang.management.DynamicMXBeanImpl
  3. extended bycom.ibm.lang.management.MemoryMXBeanImpl
All implemented interfaces:
java.lang.management.MemoryMXBean, javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

  1. public final class MemoryMXBeanImpl
  2. extends DynamicMXBeanImpl
  3. implements MemoryMXBean, javax.management.NotificationEmitter
Runtime type for MemoryMXBean.

Implementation note. This type of bean is both dynamic and a notification emitter. The dynamic behaviour comes courtesy of the DynamicMXBeanImplsuperclass while the notifying behaviour uses a delegation approach to a private member that implements the NotificationEmitterinterface. Because multiple inheritance is not supported in Java it was a toss up which behaviour would be based on inheritence and which would use delegation. Every other *MXBeanImpl class in this package inherits from the abstract base class DynamicMXBeanImpl so that seemed to be the natural approach for this class too. By choosing not to make this class a subclass of NotificationBroadcasterSupport, the protected handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object) method cannot be overridden for any custom notification behaviour. However, taking the agile mantra of YAGNI to heart, it was decided that the default implementation of that method will suffice until new requirements prove otherwise.

Since:
1.5

Field Summary

Fields inherited from class com.ibm.lang.management.DynamicMXBeanImpl
info

Method Summary

Modifier and Type Method and Description
  1. void
addNotificationListener(javax.management.NotificationListener listener,javax.management.NotificationFilter filter,java.lang.Object handback)
  1. void
gc()
  1. java.lang.String
getGCMode()
  1. java.lang.management.MemoryUsage
getHeapMemoryUsage()
  1. long
getMaxHeapSize()
  1. long
getMaxHeapSizeLimit()
  1. long
getMinHeapSize()
  1. java.lang.management.MemoryUsage
getNonHeapMemoryUsage()
  1. javax.management.MBeanNotificationInfo[]
getNotificationInfo()
  1. int
getObjectPendingFinalizationCount()
  1. long
getSharedClassCacheFreeSpace()
  1. long
getSharedClassCacheSize()
  1. boolean
isSetMaxHeapSizeSupported()
  1. boolean
isVerbose()
  1. void
removeNotificationListener(javax.management.NotificationListener listener)
  1. void
removeNotificationListener(javax.management.NotificationListener listener,javax.management.NotificationFilter filter,java.lang.Object handback)
  1. void
sendNotification(javax.management.Notification notification)
  1. void
setMaxHeapSize(long size)
  1. void
setVerbose(boolean value)
Methods inherited from class com.ibm.lang.management.DynamicMXBeanImpl
getAttribute, getAttributes, getMBeanInfo, getPresentAttribute, getPresentOperation, initMBeanInfo, invoke, setAttribute, setAttributes, setMBeanInfo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

gc

  1. public void gc()

Description copied from interface: java.lang.management.MemoryMXBean

Requests the virtual machine to run the system garbage collector.
Specified by:
gc in interface java.lang.management.MemoryMXBean

getHeapMemoryUsage

  1. public java.lang.management.MemoryUsage getHeapMemoryUsage( )

Description copied from interface: java.lang.management.MemoryMXBean

Returns the current memory usage of the heap for both live objects and for objects no longer in use which are awaiting garbage collection.
Specified by:
getHeapMemoryUsage in interface java.lang.management.MemoryMXBean
Returns:
an instance of MemoryUsagewhich can be interrogated by the caller.

getNonHeapMemoryUsage

  1. public java.lang.management.MemoryUsage getNonHeapMemoryUsage( )

Description copied from interface: java.lang.management.MemoryMXBean

Returns the current non-heap memory usage for the virtual machine.
Specified by:
getNonHeapMemoryUsage in interface java.lang.management.MemoryMXBean
Returns:
an instance of MemoryUsagewhich can be interrogated by the caller.

getObjectPendingFinalizationCount

  1. public int getObjectPendingFinalizationCount( )

Description copied from interface: java.lang.management.MemoryMXBean

Returns the number of objects in the virtual machine that are awaiting finalization. The returned value should only be used as an approximate guide.
Specified by:
getObjectPendingFinalizationCount in interface java.lang.management.MemoryMXBean
Returns:
the number of objects awaiting finalization.

isVerbose

  1. public boolean isVerbose()

Description copied from interface: java.lang.management.MemoryMXBean

Returns a boolean indication of whether or not the memory system is producing verbose output.
Specified by:
isVerbose in interface java.lang.management.MemoryMXBean
Returns:
true if verbose output is being produced ; false otherwise.

setVerbose

  1. public void setVerbose(boolean value)

Description copied from interface: java.lang.management.MemoryMXBean

Updates the verbose output setting of the memory system.
Specified by:
setVerbose in interface java.lang.management.MemoryMXBean
Parameters:
value - true enables verbose output ; false disables verbose output.
See Also:
ManagementPermission

getMaxHeapSizeLimit

  1. public long getMaxHeapSizeLimit( )

Description copied from interface: MemoryMXBean

Get the maximum size in bytes to which the max heap size could be increased in the currently running VM. This may be larger than the current max heap size.
Returns:
value of -Xmx in bytes

getMaxHeapSize

  1. public long getMaxHeapSize()

Description copied from interface: MemoryMXBean

Get the current maximum heap size in bytes.
Returns:
current value of -Xsoftmx in bytes

getMinHeapSize

  1. public long getMinHeapSize()

Description copied from interface: MemoryMXBean

Get the minimum heap size in bytes.
Returns:
value of -Xms in bytes

setMaxHeapSize

  1. public void setMaxHeapSize(long size)

Description copied from interface: MemoryMXBean

Set the current maximum heap size to size. The parameter specifies the max heap size in bytes and must be between getMinHeapSize() and getMaxHeapSizeLimit(). If this operation is not supported, this method will throw UnsupportedOperationException.
Parameters:
size - new -Xsoftmx value in bytes

isSetMaxHeapSizeSupported

  1. public boolean isSetMaxHeapSizeSupported( )

Description copied from interface: MemoryMXBean

Query whether the VM supports runtime reconfiguration of the maximum heap size through the setMaxHeapSize() call.
Returns:
true if setMaxHeapSize is supported, false otherwise

removeNotificationListener

  1. public void removeNotificationListener( javax.management.NotificationListener listener,
  2. javax.management.NotificationFilter filter,
  3. java.lang.Object handback)
  4. throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationEmitter
Throws:
javax.management.ListenerNotFoundException

addNotificationListener

  1. public void addNotificationListener( javax.management.NotificationListener listener,
  2. javax.management.NotificationFilter filter,
  3. java.lang.Object handback)
  4. throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

  1. public void removeNotificationListener( javax.management.NotificationListener listener)
  2. throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException

getNotificationInfo

  1. public javax.management.MBeanNotificationInfo[] getNotificationInfo( )
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster

sendNotification

  1. public void sendNotification(javax.management.Notification notification)

getSharedClassCacheSize

  1. public long getSharedClassCacheSize( )

Description copied from interface: MemoryMXBean

Returns the total size in bytes of the cache that the JVM is currently connected to.
Returns:
the number of bytes in the shared class cache.

getSharedClassCacheFreeSpace

  1. public long getSharedClassCacheFreeSpace( )

Description copied from interface: MemoryMXBean

Returns the free space in bytes of the cache that the JVM is currently connected to.
Returns:
the number of bytes free in the shared class cache.

getGCMode

  1. public java.lang.String getGCMode( )

Description copied from interface: MemoryMXBean

Returns the current GC mode as a human-readable string.
Returns:
a String describing the mode the GC is currently operating in