Java Code Examples for com.sun.management.VMOption#getValue()

The following examples show how to use com.sun.management.VMOption#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GetVMOption.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 2
Source File: GetVMOption.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 3
Source File: GetVMOption.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 4
Source File: GetVMOption.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 5
Source File: GetVMOption.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 6
Source File: GetVMOption.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 7
Source File: GetVMOption.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
Example 8
Source File: CompilerWhiteBoxTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
Example 9
Source File: SetAllVMOptions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void setAllVMOptions(HotSpotDiagnosticMXBean mbean) {
    List<VMOption> options = mbean.getDiagnosticOptions();
    for (VMOption opt : options) {
        String name = opt.getName();
        String val = opt.getValue();
        System.out.println("option: "+name+"="+val);
        mbean.setVMOption(name,val);
    }
}
 
Example 10
Source File: CompilerWhiteBoxTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
Example 11
Source File: TestG1HeapRegionSize.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  String expectedValue = getExpectedValue(args);
  VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
Example 12
Source File: SetAllVMOptions.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void setAllVMOptions(HotSpotDiagnosticMXBean mbean) {
    List<VMOption> options = mbean.getDiagnosticOptions();
    for (VMOption opt : options) {
        String name = opt.getName();
        String val = opt.getValue();
        System.out.println("option: "+name+"="+val);
        mbean.setVMOption(name,val);
    }
}
 
Example 13
Source File: SetAllVMOptions.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void setAllVMOptions(HotSpotDiagnosticMXBean mbean) {
    List<VMOption> options = mbean.getDiagnosticOptions();
    for (VMOption opt : options) {
        String name = opt.getName();
        String val = opt.getValue();
        System.out.println("option: "+name+"="+val);
        mbean.setVMOption(name,val);
    }
}
 
Example 14
Source File: CompilerWhiteBoxTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
Example 15
Source File: SetAllVMOptions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void setAllVMOptions(HotSpotDiagnosticMXBean mbean) {
    List<VMOption> options = mbean.getDiagnosticOptions();
    for (VMOption opt : options) {
        String name = opt.getName();
        String val = opt.getValue();
        System.out.println("option: "+name+"="+val);
        mbean.setVMOption(name,val);
    }
}
 
Example 16
Source File: SetVMOption.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 17
Source File: SetVMOption.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 18
Source File: SetVMOption.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 19
Source File: SetVMOption.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 20
Source File: SetVMOption.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}