public final class MemoryMXBeanImpl extends DynamicMXBeanImpl implements MemoryMXBean, javax.management.NotificationEmitter
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.
info| Modifier and Type | Method and Description |
|---|---|
void |
addNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback) |
void |
gc()
Requests the virtual machine to run the system garbage collector.
|
java.lang.String |
getGCMode()
Returns the current GC mode as a human-readable string.
|
java.lang.management.MemoryUsage |
getHeapMemoryUsage()
Returns the current memory usage of the heap for both live objects and
for objects no longer in use which are awaiting garbage collection.
|
long |
getMaxHeapSize()
Get the current maximum heap size in bytes.
|
long |
getMaxHeapSizeLimit()
Get the maximum size in bytes to which the max heap size could be
increased in the currently running VM.
|
long |
getMinHeapSize()
Get the minimum heap size in bytes.
|
java.lang.management.MemoryUsage |
getNonHeapMemoryUsage()
Returns the current non-heap memory usage for the virtual machine.
|
javax.management.MBeanNotificationInfo[] |
getNotificationInfo() |
int |
getObjectPendingFinalizationCount()
Returns the number of objects in the virtual machine that are awaiting
finalization.
|
long |
getSharedClassCacheFreeSpace()
Returns the free space in bytes of the cache that the JVM is
currently connected to.
|
long |
getSharedClassCacheSize()
Returns the total size in bytes of the cache that the JVM is currently
connected to.
|
boolean |
isSetMaxHeapSizeSupported()
Query whether the VM supports runtime reconfiguration of the
maximum heap size through the setMaxHeapSize() call.
|
boolean |
isVerbose()
Returns a boolean indication of whether or not the memory system is
producing verbose output.
|
void |
removeNotificationListener(javax.management.NotificationListener listener) |
void |
removeNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback) |
void |
sendNotification(javax.management.Notification notification) |
void |
setMaxHeapSize(long size)
Set the current maximum heap size to
size. |
void |
setVerbose(boolean value)
Updates the verbose output setting of the memory system.
|
getAttribute, getAttributes, getMBeanInfo, getPresentAttribute, getPresentOperation, initMBeanInfo, invoke, setAttribute, setAttributes, setMBeanInfopublic void gc()
java.lang.management.MemoryMXBeangc in interface java.lang.management.MemoryMXBeanpublic java.lang.management.MemoryUsage getHeapMemoryUsage()
java.lang.management.MemoryMXBeangetHeapMemoryUsage in interface java.lang.management.MemoryMXBeanMemoryUsagewhich can be interrogated by
the caller.public java.lang.management.MemoryUsage getNonHeapMemoryUsage()
java.lang.management.MemoryMXBeangetNonHeapMemoryUsage in interface java.lang.management.MemoryMXBeanMemoryUsagewhich can be interrogated by
the caller.public int getObjectPendingFinalizationCount()
java.lang.management.MemoryMXBeangetObjectPendingFinalizationCount in interface java.lang.management.MemoryMXBeanpublic boolean isVerbose()
java.lang.management.MemoryMXBeanisVerbose in interface java.lang.management.MemoryMXBeantrue if verbose output is being produced ;
false otherwise.public void setVerbose(boolean value)
java.lang.management.MemoryMXBeansetVerbose in interface java.lang.management.MemoryMXBeanvalue - true enables verbose output ;
false disables verbose output.ManagementPermissionpublic long getMaxHeapSizeLimit()
MemoryMXBeanpublic long getMaxHeapSize()
MemoryMXBeanpublic long getMinHeapSize()
MemoryMXBeanpublic void setMaxHeapSize(long size)
MemoryMXBeansize.
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.size - new -Xsoftmx value in bytespublic boolean isSetMaxHeapSizeSupported()
MemoryMXBeanpublic void removeNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
throws javax.management.ListenerNotFoundException
removeNotificationListener in interface javax.management.NotificationEmitterjavax.management.ListenerNotFoundExceptionpublic void addNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
throws java.lang.IllegalArgumentException
addNotificationListener in interface javax.management.NotificationBroadcasterjava.lang.IllegalArgumentExceptionpublic void removeNotificationListener(javax.management.NotificationListener listener)
throws javax.management.ListenerNotFoundException
removeNotificationListener in interface javax.management.NotificationBroadcasterjavax.management.ListenerNotFoundExceptionpublic javax.management.MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo in interface javax.management.NotificationBroadcasterpublic void sendNotification(javax.management.Notification notification)
public long getSharedClassCacheSize()
MemoryMXBeanpublic long getSharedClassCacheFreeSpace()
MemoryMXBeanpublic java.lang.String getGCMode()
MemoryMXBean