< prev index next >

test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java

Print this page
rev 16783 : 8176176: fix @modules in jdk_svc tests
Reviewed-by: duke


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4982301
  27  * @summary Sanity Test for GarbageCollectorMXBean.getLastGcInfo().
  28  * @author  Mandy Chung
  29  *
  30  * @modules jdk.management
  31  * @run main/othervm -XX:-ExplicitGCInvokesConcurrent LastGCInfo
  32  */
  33 // Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
  34 // run on foreground when CMS is used and prevent situations when "GcInfo"
  35 // is missing even though System.gc() was successfuly processed.
  36 
  37 import java.lang.management.ManagementFactory;
  38 import java.lang.management.MemoryUsage;
  39 import java.lang.management.MemoryPoolMXBean;
  40 import java.util.*;
  41 import com.sun.management.GcInfo;
  42 import com.sun.management.GarbageCollectorMXBean;
  43 
  44 public class LastGCInfo {
  45     public static void main(String[] argv) throws Exception {
  46         boolean hasGcInfo = false;
  47 
  48         System.gc();
  49         List mgrs = ManagementFactory.getGarbageCollectorMXBeans();
  50         for (ListIterator iter = mgrs.listIterator(); iter.hasNext(); ) {




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4982301
  27  * @summary Sanity Test for GarbageCollectorMXBean.getLastGcInfo().
  28  * @author  Mandy Chung
  29  *

  30  * @run main/othervm -XX:-ExplicitGCInvokesConcurrent LastGCInfo
  31  */
  32 // Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
  33 // run on foreground when CMS is used and prevent situations when "GcInfo"
  34 // is missing even though System.gc() was successfuly processed.
  35 
  36 import java.lang.management.ManagementFactory;
  37 import java.lang.management.MemoryUsage;
  38 import java.lang.management.MemoryPoolMXBean;
  39 import java.util.*;
  40 import com.sun.management.GcInfo;
  41 import com.sun.management.GarbageCollectorMXBean;
  42 
  43 public class LastGCInfo {
  44     public static void main(String[] argv) throws Exception {
  45         boolean hasGcInfo = false;
  46 
  47         System.gc();
  48         List mgrs = ManagementFactory.getGarbageCollectorMXBeans();
  49         for (ListIterator iter = mgrs.listIterator(); iter.hasNext(); ) {


< prev index next >