8151099: java.lang.management.ManagementFactory.getPlatformMXBeans() should work even if jdk.management is not present

Removed dependency of java.management over jdk.management.

Reviewed-by: mchung, dfuchs, dholmes
This commit is contained in:
Amit Sapre 2016-10-26 14:58:14 +05:30 committed by Vyom Tewari
parent 5a51418eb9
commit efe353282a
2 changed files with 20 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -173,6 +173,20 @@ void Management::get_optional_support(jmmOptionalSupport* support) {
Klass* Management::load_and_initialize_klass(Symbol* sh, TRAPS) {
Klass* k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL);
Klass* ik = initialize_klass(k, CHECK_NULL);
return ik;
}
Klass* Management::load_and_initialize_klass_or_null(Symbol* sh, TRAPS) {
Klass* k = SystemDictionary::resolve_or_null(sh, CHECK_NULL);
if (k == NULL) {
return NULL;
}
Klass* ik = initialize_klass(k, CHECK_NULL);
return ik;
}
Klass* Management::initialize_klass(Klass* k, TRAPS) {
instanceKlassHandle ik (THREAD, k);
if (ik->should_be_initialized()) {
ik->initialize(CHECK_NULL);
@ -255,7 +269,8 @@ Klass* Management::sun_management_ManagementFactoryHelper_klass(TRAPS) {
Klass* Management::com_sun_management_internal_GarbageCollectorExtImpl_klass(TRAPS) {
if (_garbageCollectorExtImpl_klass == NULL) {
_garbageCollectorExtImpl_klass = load_and_initialize_klass(vmSymbols::com_sun_management_internal_GarbageCollectorExtImpl(), CHECK_NULL);
_garbageCollectorExtImpl_klass =
load_and_initialize_klass_or_null(vmSymbols::com_sun_management_internal_GarbageCollectorExtImpl(), CHECK_NULL);
}
return _garbageCollectorExtImpl_klass;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,6 +53,8 @@ private:
static Klass* _sensor_klass;
static Klass* _threadInfo_klass;
static Klass* load_and_initialize_klass(Symbol* sh, TRAPS);
static Klass* load_and_initialize_klass_or_null(Symbol* sh, TRAPS);
static Klass* initialize_klass(Klass* k, TRAPS);
public:
static void init();