Java Code Examples for java.lang.management.MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED

The following are Jave code examples for showing how to use MEMORY_COLLECTION_THRESHOLD_EXCEEDED of the java.lang.management.MemoryNotificationInfo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: javify   File: MemoryMXBeanImpl.java   Source Code and License Vote up 5 votes
public MBeanNotificationInfo[] getNotificationInfo()
{
  return new MBeanNotificationInfo[]
    {
      new MBeanNotificationInfo(new String[]
        {
          MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
          MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
        },
                                Notification.class.getName(),
                                "Memory Usage Notifications")
    };
}
 
Example 2
Project: jvm-stm   File: MemoryMXBeanImpl.java   Source Code and License Vote up 5 votes
public MBeanNotificationInfo[] getNotificationInfo()
 {
   return new MBeanNotificationInfo[]
     {
new MBeanNotificationInfo(new String[]
  {
    MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
    MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
  },
			  Notification.class.getName(), 
			  "Memory Usage Notifications")
     };
 }
 
Example 3
Project: cn1   File: ManagementUtils.java   Source Code and License Vote up 5 votes
/**
 * Creates the metadata for the {@link java.lang.management.MemoryMXBean}.
 * For this type of platform bean the metadata covers :
 * <ul>
 * <li>4 attributes
 * <li>0 constructors
 * <li>1 operations
 * <li>1 notification
 * </ul>
 * 
 * @param map
 */
private static void addMemoryBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[4];
    attributes[0] = new MBeanAttributeInfo("HeapMemoryUsage",
            CompositeData.class.getName(), "HeapMemoryUsage", true, false,
            false);
    attributes[1] = new MBeanAttributeInfo("NonHeapMemoryUsage",
            CompositeData.class.getName(), "NonHeapMemoryUsage", true,
            false, false);
    attributes[2] = new MBeanAttributeInfo(
            "ObjectPendingFinalizationCount", Integer.TYPE.getName(),
            "ObjectPendingFinalizationCount", true, false, false);
    attributes[3] = new MBeanAttributeInfo("Verbose", Boolean.TYPE
            .getName(), "Verbose", true, true, true);

    // Operations
    MBeanOperationInfo[] operations = new MBeanOperationInfo[1];
    MBeanParameterInfo[] params = new MBeanParameterInfo[0];
    operations[0] = new MBeanOperationInfo("gc", "gc", params, Void.TYPE
            .getName(), MBeanOperationInfo.ACTION_INFO);

    // Notifications
    MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[1];
    String[] notifTypes = new String[2];
    notifTypes[0] = MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED;
    notifTypes[1] = MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED;
    notifications[0] = new MBeanNotificationInfo(notifTypes,
            javax.management.Notification.class.getName(),
            "Memory Notification");

    MBeanInfo mbeanInfo = new MBeanInfo(MemoryMXBeanImpl.class.getName(),
            MemoryMXBeanImpl.class.getName(), attributes, null, operations,
            notifications);
    map.put(MemoryMXBean.class.getName(), mbeanInfo);
}
 
Example 4
Project: JamVM-PH   File: MemoryMXBeanImpl.java   Source Code and License Vote up 5 votes
public MBeanNotificationInfo[] getNotificationInfo()
 {
   return new MBeanNotificationInfo[]
     {
new MBeanNotificationInfo(new String[]
  {
    MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
    MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
  },
			  Notification.class.getName(), 
			  "Memory Usage Notifications")
     };
 }
 
Example 5
Project: classpath   File: MemoryMXBeanImpl.java   Source Code and License Vote up 5 votes
public MBeanNotificationInfo[] getNotificationInfo()
{
  return new MBeanNotificationInfo[]
    {
      new MBeanNotificationInfo(new String[]
        {
          MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
          MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
        },
                                Notification.class.getName(),
                                "Memory Usage Notifications")
    };
}
 
Example 6
Project: freeVM   File: ManagementUtils.java   Source Code and License Vote up 5 votes
/**
 * Creates the metadata for the {@link java.lang.management.MemoryMXBean}.
 * For this type of platform bean the metadata covers :
 * <ul>
 * <li>4 attributes
 * <li>0 constructors
 * <li>1 operations
 * <li>1 notification
 * </ul>
 * 
 * @param map
 */
private static void addMemoryBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[4];
    attributes[0] = new MBeanAttributeInfo("HeapMemoryUsage",
            CompositeData.class.getName(), "HeapMemoryUsage", true, false,
            false);
    attributes[1] = new MBeanAttributeInfo("NonHeapMemoryUsage",
            CompositeData.class.getName(), "NonHeapMemoryUsage", true,
            false, false);
    attributes[2] = new MBeanAttributeInfo(
            "ObjectPendingFinalizationCount", Integer.TYPE.getName(),
            "ObjectPendingFinalizationCount", true, false, false);
    attributes[3] = new MBeanAttributeInfo("Verbose", Boolean.TYPE
            .getName(), "Verbose", true, true, true);

    // Operations
    MBeanOperationInfo[] operations = new MBeanOperationInfo[1];
    MBeanParameterInfo[] params = new MBeanParameterInfo[0];
    operations[0] = new MBeanOperationInfo("gc", "gc", params, Void.TYPE
            .getName(), MBeanOperationInfo.ACTION_INFO);

    // Notifications
    MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[1];
    String[] notifTypes = new String[2];
    notifTypes[0] = MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED;
    notifTypes[1] = MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED;
    notifications[0] = new MBeanNotificationInfo(notifTypes,
            javax.management.Notification.class.getName(),
            "Memory Notification");

    MBeanInfo mbeanInfo = new MBeanInfo(MemoryMXBeanImpl.class.getName(),
            MemoryMXBeanImpl.class.getName(), attributes, null, operations,
            notifications);
    map.put(MemoryMXBean.class.getName(), mbeanInfo);
}
 
Example 7
Project: freeVM   File: ManagementUtils.java   Source Code and License Vote up 5 votes
/**
 * Creates the metadata for the {@link java.lang.management.MemoryMXBean}.
 * For this type of platform bean the metadata covers :
 * <ul>
 * <li>4 attributes
 * <li>0 constructors
 * <li>1 operations
 * <li>1 notification
 * </ul>
 * 
 * @param map
 */
private static void addMemoryBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[4];
    attributes[0] = new MBeanAttributeInfo("HeapMemoryUsage",
            CompositeData.class.getName(), "HeapMemoryUsage", true, false,
            false);
    attributes[1] = new MBeanAttributeInfo("NonHeapMemoryUsage",
            CompositeData.class.getName(), "NonHeapMemoryUsage", true,
            false, false);
    attributes[2] = new MBeanAttributeInfo(
            "ObjectPendingFinalizationCount", Integer.TYPE.getName(),
            "ObjectPendingFinalizationCount", true, false, false);
    attributes[3] = new MBeanAttributeInfo("Verbose", Boolean.TYPE
            .getName(), "Verbose", true, true, true);

    // Operations
    MBeanOperationInfo[] operations = new MBeanOperationInfo[1];
    MBeanParameterInfo[] params = new MBeanParameterInfo[0];
    operations[0] = new MBeanOperationInfo("gc", "gc", params, Void.TYPE
            .getName(), MBeanOperationInfo.ACTION_INFO);

    // Notifications
    MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[1];
    String[] notifTypes = new String[2];
    notifTypes[0] = MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED;
    notifTypes[1] = MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED;
    notifications[0] = new MBeanNotificationInfo(notifTypes,
            javax.management.Notification.class.getName(),
            "Memory Notification");

    MBeanInfo mbeanInfo = new MBeanInfo(MemoryMXBeanImpl.class.getName(),
            MemoryMXBeanImpl.class.getName(), attributes, null, operations,
            notifications);
    map.put(MemoryMXBean.class.getName(), mbeanInfo);
}
 
Example 8
Project: cn1   File: MemoryNotificationThread.java   Source Code and License Vote up 4 votes
/**
 * A helper method called from within the native
 * {@link #processNotificationLoop(int)} method to construct and dispatch
 * notification objects.
 * 
 * @param min
 *            the initial amount in bytes of memory that can be allocated by
 *            this virtual machine
 * @param used
 *            the number of bytes currently used for memory
 * @param committed
 *            the number of bytes of committed memory
 * @param max
 *            the maximum number of bytes that can be used for memory
 *            management purposes
 * @param count
 *            the number of times that the memory usage of the memory pool
 *            in question has met or exceeded the relevant threshold
 * @param sequenceNumber
 *            the sequence identifier of the current notification
 * @param isCollectionUsageNotification
 *            a <code>boolean</code> indication of whether or not the new
 *            notification is as a result of the collection threshold being
 *            exceeded. If this value is <code>false</code> then the
 *            implication is that a memory threshold has been exceeded.
 */
@SuppressWarnings("unused")
// IMPORTANT: for use by VM
private void dispatchNotificationHelper(long min, long used,
        long committed, long max, long count, long sequenceNumber,
        boolean isCollectionUsageNotification) {
    MemoryNotificationInfo info = new MemoryNotificationInfo(memPool
            .getName(), new MemoryUsage(min, used, committed, max), count);
    Notification n = new Notification(
            isCollectionUsageNotification ? MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED
                    : MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
            "java.lang:type=Memory", sequenceNumber);
    n.setUserData(ManagementUtils
            .toMemoryNotificationInfoCompositeData(info));
    memBean.sendNotification(n);
}
 
Example 9
Project: freeVM   File: MemoryNotificationThread.java   Source Code and License Vote up 4 votes
/**
 * A helper method called from within the native
 * {@link #processNotificationLoop(int)} method to construct and dispatch
 * notification objects.
 * 
 * @param min
 *            the initial amount in bytes of memory that can be allocated by
 *            this virtual machine
 * @param used
 *            the number of bytes currently used for memory
 * @param committed
 *            the number of bytes of committed memory
 * @param max
 *            the maximum number of bytes that can be used for memory
 *            management purposes
 * @param count
 *            the number of times that the memory usage of the memory pool
 *            in question has met or exceeded the relevant threshold
 * @param sequenceNumber
 *            the sequence identifier of the current notification
 * @param isCollectionUsageNotification
 *            a <code>boolean</code> indication of whether or not the new
 *            notification is as a result of the collection threshold being
 *            exceeded. If this value is <code>false</code> then the
 *            implication is that a memory threshold has been exceeded.
 */
@SuppressWarnings("unused")
// IMPORTANT: for use by VM
private void dispatchNotificationHelper(long min, long used,
        long committed, long max, long count, long sequenceNumber,
        boolean isCollectionUsageNotification) {
    MemoryNotificationInfo info = new MemoryNotificationInfo(memPool
            .getName(), new MemoryUsage(min, used, committed, max), count);
    Notification n = new Notification(
            isCollectionUsageNotification ? MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED
                    : MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
            "java.lang:type=Memory", sequenceNumber);
    n.setUserData(ManagementUtils
            .toMemoryNotificationInfoCompositeData(info));
    memBean.sendNotification(n);
}
 
Example 10
Project: freeVM   File: MemoryNotificationThread.java   Source Code and License Vote up 4 votes
/**
 * A helper method called from within the native
 * {@link #processNotificationLoop(int)} method to construct and dispatch
 * notification objects.
 * 
 * @param min
 *            the initial amount in bytes of memory that can be allocated by
 *            this virtual machine
 * @param used
 *            the number of bytes currently used for memory
 * @param committed
 *            the number of bytes of committed memory
 * @param max
 *            the maximum number of bytes that can be used for memory
 *            management purposes
 * @param count
 *            the number of times that the memory usage of the memory pool
 *            in question has met or exceeded the relevant threshold
 * @param sequenceNumber
 *            the sequence identifier of the current notification
 * @param isCollectionUsageNotification
 *            a <code>boolean</code> indication of whether or not the new
 *            notification is as a result of the collection threshold being
 *            exceeded. If this value is <code>false</code> then the
 *            implication is that a memory threshold has been exceeded.
 */
@SuppressWarnings("unused")
// IMPORTANT: for use by VM
private void dispatchNotificationHelper(long min, long used,
        long committed, long max, long count, long sequenceNumber,
        boolean isCollectionUsageNotification) {
    MemoryNotificationInfo info = new MemoryNotificationInfo(memPool
            .getName(), new MemoryUsage(min, used, committed, max), count);
    Notification n = new Notification(
            isCollectionUsageNotification ? MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED
                    : MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
            "java.lang:type=Memory", sequenceNumber);
    n.setUserData(ManagementUtils
            .toMemoryNotificationInfoCompositeData(info));
    memBean.sendNotification(n);
}