4235N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4235N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4235N/A * This code is free software; you can redistribute it and/or modify it 4235N/A * under the terms of the GNU General Public License version 2 only, as 4235N/A * published by the Free Software Foundation. Oracle designates this 4235N/A * particular file as subject to the "Classpath" exception as provided 4235N/A * by Oracle in the LICENSE file that accompanied this code. 4235N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4235N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4235N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4235N/A * version 2 for more details (a copy is included in the LICENSE file that 4235N/A * You should have received a copy of the GNU General Public License version 4235N/A * 2 along with this work; if not, write to the Free Software Foundation, 4235N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4235N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4235N/A * or visit www.oracle.com if you need additional information or have any 4235N/A * The information about a garbage collection 4235N/A * A garbage collection notification is emitted by {@link GarbageCollectorMXBean} 4235N/A * when the Java virtual machine completes a garbage collection action 4235N/A * The notification emitted will contain the garbage collection notification 4235N/A * information about the status of the memory: 4235N/A * <li>The name of the garbage collector used perform the collection.</li> 4235N/A * <li>The action performed by the garbage collector.</li> 4235N/A * <li>The cause of the garbage collection action.</li> 4235N/A * <li>A {@link GcInfo} object containing some statistics about the GC cycle 4235N/A (start time, end time) and the memory usage before and after 4235N/A * A {@link CompositeData CompositeData} representing 4235N/A * the {@code GarbageCollectionNotificationInfo} object 4235N/A * {@linkplain javax.management.Notification#setUserData userdata} 4235N/A * of a {@linkplain javax.management.Notification notification}. 4235N/A * The {@link #from from} method is provided to convert from 4235N/A * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo} 4235N/A * // receive the notification emitted by a GarbageCollectorMXBean and set to notif 4235N/A * String notifType = notif.getType(); 4235N/A * if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) { 4235N/A * // retrieve the garbage collection notification information 4235N/A * CompositeData cd = (CompositeData) notif.getUserData(); 4235N/A * GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd); 4235N/A * The type of the notification emitted by a {@code GarbageCollectorMXBean} is: 4235N/A * <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}. 4235N/A * <br>Used by every notification emitted by the garbage collector, the details about 4235N/A * the notification are provided in the {@linkplain #getGcAction action} String 4235N/A * Notification type denoting that 4235N/A * the Java virtual machine has completed a garbage collection cycle. 4235N/A * This notification is emitted by a {@link GarbageCollectorMXBean}. 4235N/A * The value of this notification type is 4235N/A * {@code com.sun.management.gc.notification}. 4235N/A "com.sun.management.gc.notification";
4235N/A * Constructs a {@code GarbageCollectionNotificationInfo} object. 4235N/A * @param gcName The name of the garbage collector used to perform the collection 4235N/A * @param gcAction The name of the action performed by the garbage collector 4235N/A * @param gcCause The cause the garbage collection action 4235N/A * @param gcInfo a GcInfo object providing statistics about the GC cycle 4235N/A * Returns the name of the garbage collector used to perform the collection 4235N/A * @return the name of the garbage collector used to perform the collection 4235N/A * Returns the action of the performed by the garbage collector 4235N/A * @return the the action of the performed by the garbage collector 4235N/A * Returns the cause the garbage collection 4235N/A * @return the the cause the garbage collection 4235N/A * Returns the GC information related to the last garbage collection 4235N/A * @return the GC information related to the 4235N/A * Returns a {@code GarbageCollectionNotificationInfo} object represented by the 4235N/A * given {@code CompositeData}. 4235N/A * The given {@code CompositeData} must contain 4235N/A * the following attributes: 4235N/A * <th align=left>Attribute Name</th> 4235N/A * <td>{@code java.lang.String}</td> 4235N/A * <td>{@code java.lang.String}</td> 4235N/A * <td>{@code java.lang.String}</td> 4235N/A * <td>{@code javax.management.openmbean.CompositeData}</td> 4235N/A * @param cd {@code CompositeData} representing a 4235N/A * {@code GarbageCollectionNotificationInfo} 4235N/A * @throws IllegalArgumentException if {@code cd} does not 4235N/A * represent a {@code GarbaageCollectionNotificationInfo} object. 4235N/A * @return a {@code GarbageCollectionNotificationInfo} object represented 4235N/A * by {@code cd} if {@code cd} is not {@code null};