hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
changeset 29319 54c7d4e5261f
parent 20293 1dd93ae4304d
child 40033 dbd5f9838049
equal deleted inserted replaced
29318:506962bddb02 29319:54c7d4e5261f
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 package sun.hotspot.tools.ctw;
    24 package sun.hotspot.tools.ctw;
    25 
    25 
    26 import com.sun.management.HotSpotDiagnosticMXBean;
    26 import com.sun.management.HotSpotDiagnosticMXBean;
    27 import sun.management.ManagementFactoryHelper;
    27 import java.lang.management.ManagementFactory;
    28 
    28 
    29 import java.io.File;
    29 import java.io.File;
    30 import java.util.regex.Pattern;
    30 import java.util.regex.Pattern;
    31 
    31 
    32 /**
    32 /**
   158      * @throws NullPointerException if name is null
   158      * @throws NullPointerException if name is null
   159      */
   159      */
   160     public static String getVMOption(String name) {
   160     public static String getVMOption(String name) {
   161         String result;
   161         String result;
   162         HotSpotDiagnosticMXBean diagnostic
   162         HotSpotDiagnosticMXBean diagnostic
   163                 = ManagementFactoryHelper.getDiagnosticMXBean();
   163                 = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
   164         result = diagnostic.getVMOption(name).getValue();
   164         result = diagnostic.getVMOption(name).getValue();
   165         return result;
   165         return result;
   166     }
   166     }
   167 
   167 
   168     /**
   168     /**