src/share/vm/services/management.cpp

Print this page

        

*** 44,54 **** #include "services/diagnosticFramework.hpp" #include "services/heapDumper.hpp" #include "services/jmm.h" #include "services/lowMemoryDetector.hpp" #include "services/gcNotifier.hpp" - #include "services/nmtDCmd.hpp" #include "services/management.hpp" #include "services/memoryManager.hpp" #include "services/memoryPool.hpp" #include "services/memoryService.hpp" #include "services/runtimeService.hpp" --- 44,53 ----
*** 65,75 **** --- 64,77 ---- Klass* Management::_memoryManagerMXBean_klass = NULL; Klass* Management::_garbageCollectorMXBean_klass = NULL; Klass* Management::_managementFactory_klass = NULL; Klass* Management::_garbageCollectorImpl_klass = NULL; Klass* Management::_gcInfo_klass = NULL; + Klass* Management::_diagnosticCommandImpl_klass = NULL; + Klass* Management::_managementFactoryHelper_klass = NULL; + jmmOptionalSupport Management::_optional_support = {0}; TimeStamp Management::_stamp; void management_init() { #if INCLUDE_MANAGEMENT
*** 125,139 **** #if INCLUDE_SERVICES // This depends on the heap inspector _optional_support.isSynchronizerUsageSupported = 1; #endif // INCLUDE_SERVICES _optional_support.isThreadAllocatedMemorySupported = 1; // Registration of the diagnostic commands DCmdRegistrant::register_dcmds(); DCmdRegistrant::register_dcmds_ext(); - DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<NMTDCmd>(true, false)); } void Management::initialize(TRAPS) { // Start the service thread ServiceThread::initialize(); --- 127,141 ---- #if INCLUDE_SERVICES // This depends on the heap inspector _optional_support.isSynchronizerUsageSupported = 1; #endif // INCLUDE_SERVICES _optional_support.isThreadAllocatedMemorySupported = 1; + _optional_support.isRemoteDiagnosticCommandsSupported = 1; // Registration of the diagnostic commands DCmdRegistrant::register_dcmds(); DCmdRegistrant::register_dcmds_ext(); } void Management::initialize(TRAPS) { // Start the service thread ServiceThread::initialize();
*** 259,268 **** --- 261,284 ---- _gcInfo_klass = load_and_initialize_klass(vmSymbols::com_sun_management_GcInfo(), CHECK_NULL); } return _gcInfo_klass; } + Klass* Management::sun_management_DiagnosticCommandImpl_klass(TRAPS) { + if (_diagnosticCommandImpl_klass == NULL) { + _diagnosticCommandImpl_klass = load_and_initialize_klass(vmSymbols::sun_management_DiagnosticCommandImpl(), CHECK_NULL); + } + return _diagnosticCommandImpl_klass; + } + + Klass* Management::sun_management_ManagementFactoryHelper_klass(TRAPS) { + if (_managementFactoryHelper_klass == NULL) { + _managementFactoryHelper_klass = load_and_initialize_klass(vmSymbols::sun_management_ManagementFactoryHelper(), CHECK_NULL); + } + return _managementFactoryHelper_klass; + } + static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args, ThreadSnapshot* snapshot, TRAPS) { Handle snapshot_thread(THREAD, snapshot->threadObj()); jlong contended_time; jlong waited_time;
*** 2141,2151 **** #endif // INCLUDE_SERVICES JVM_END JVM_ENTRY(jobjectArray, jmm_GetDiagnosticCommands(JNIEnv *env)) ResourceMark rm(THREAD); ! GrowableArray<const char *>* dcmd_list = DCmdFactory::DCmd_list(); objArrayOop cmd_array_oop = oopFactory::new_objArray(SystemDictionary::String_klass(), dcmd_list->length(), CHECK_NULL); objArrayHandle cmd_array(THREAD, cmd_array_oop); for (int i = 0; i < dcmd_list->length(); i++) { oop cmd_name = java_lang_String::create_oop_from_str(dcmd_list->at(i), CHECK_NULL); --- 2157,2167 ---- #endif // INCLUDE_SERVICES JVM_END JVM_ENTRY(jobjectArray, jmm_GetDiagnosticCommands(JNIEnv *env)) ResourceMark rm(THREAD); ! GrowableArray<const char *>* dcmd_list = DCmdFactory::DCmd_list(DCmd_Source_MBean); objArrayOop cmd_array_oop = oopFactory::new_objArray(SystemDictionary::String_klass(), dcmd_list->length(), CHECK_NULL); objArrayHandle cmd_array(THREAD, cmd_array_oop); for (int i = 0; i < dcmd_list->length(); i++) { oop cmd_name = java_lang_String::create_oop_from_str(dcmd_list->at(i), CHECK_NULL);
*** 2170,2180 **** if (element_klass != SystemDictionary::String_klass()) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Array element type is not String class"); } ! GrowableArray<DCmdInfo *>* info_list = DCmdFactory::DCmdInfo_list(); int num_cmds = cmds_ah->length(); for (int i = 0; i < num_cmds; i++) { oop cmd = cmds_ah->obj_at(i); if (cmd == NULL) { --- 2186,2196 ---- if (element_klass != SystemDictionary::String_klass()) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Array element type is not String class"); } ! GrowableArray<DCmdInfo *>* info_list = DCmdFactory::DCmdInfo_list(DCmd_Source_MBean); int num_cmds = cmds_ah->length(); for (int i = 0; i < num_cmds; i++) { oop cmd = cmds_ah->obj_at(i); if (cmd == NULL) {
*** 2193,2202 **** --- 2209,2222 ---- } DCmdInfo* info = info_list->at(pos); infoArray[i].name = info->name(); infoArray[i].description = info->description(); infoArray[i].impact = info->impact(); + JavaPermission p = info->permission(); + infoArray[i].permission_class = p._class; + infoArray[i].permission_name = p._name; + infoArray[i].permission_action = p._action; infoArray[i].num_arguments = info->num_arguments(); infoArray[i].enabled = info->is_enabled(); } JVM_END
*** 2212,2222 **** if (cmd_name == NULL) { THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Command line content cannot be null."); } DCmd* dcmd = NULL; ! DCmdFactory*factory = DCmdFactory::factory(cmd_name, strlen(cmd_name)); if (factory != NULL) { dcmd = factory->create_resource_instance(NULL); } if (dcmd == NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), --- 2232,2243 ---- if (cmd_name == NULL) { THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Command line content cannot be null."); } DCmd* dcmd = NULL; ! DCmdFactory*factory = DCmdFactory::factory(DCmd_Source_MBean, cmd_name, ! strlen(cmd_name)); if (factory != NULL) { dcmd = factory->create_resource_instance(NULL); } if (dcmd == NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
*** 2232,2241 **** --- 2253,2263 ---- infoArray[i].description = array->at(i)->description(); infoArray[i].type = array->at(i)->type(); infoArray[i].default_string = array->at(i)->default_string(); infoArray[i].mandatory = array->at(i)->is_mandatory(); infoArray[i].option = array->at(i)->is_option(); + infoArray[i].multiple = array->at(i)->is_multiple(); infoArray[i].position = array->at(i)->position(); } return; JVM_END
*** 2250,2264 **** if (cmdline == NULL) { THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Command line content cannot be null."); } bufferedStream output; ! DCmd::parse_and_execute(&output, cmdline, ' ', CHECK_NULL); oop result = java_lang_String::create_oop_from_str(output.as_string(), CHECK_NULL); return (jstring) JNIHandles::make_local(env, result); JVM_END jlong Management::ticks_to_ms(jlong ticks) { assert(os::elapsed_frequency() > 0, "Must be non-zero"); return (jlong)(((double)ticks / (double)os::elapsed_frequency()) * (double)1000.0); } --- 2272,2290 ---- if (cmdline == NULL) { THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Command line content cannot be null."); } bufferedStream output; ! DCmd::parse_and_execute(DCmd_Source_MBean, &output, cmdline, ' ', CHECK_NULL); oop result = java_lang_String::create_oop_from_str(output.as_string(), CHECK_NULL); return (jstring) JNIHandles::make_local(env, result); JVM_END + JVM_ENTRY(void, jmm_SetDiagnosticFrameworkNotificationEnabled(JNIEnv *env, jboolean enabled)) + DCmdFactory::set_jmx_notification_enabled(enabled?true:false); + JVM_END + jlong Management::ticks_to_ms(jlong ticks) { assert(os::elapsed_frequency() > 0, "Must be non-zero"); return (jlong)(((double)ticks / (double)os::elapsed_frequency()) * (double)1000.0); }
*** 2301,2311 **** jmm_DumpThreads, jmm_SetGCNotificationEnabled, jmm_GetDiagnosticCommands, jmm_GetDiagnosticCommandInfo, jmm_GetDiagnosticCommandArgumentsInfo, ! jmm_ExecuteDiagnosticCommand }; #endif // INCLUDE_MANAGEMENT void* Management::get_jmm_interface(int version) { #if INCLUDE_MANAGEMENT --- 2327,2338 ---- jmm_DumpThreads, jmm_SetGCNotificationEnabled, jmm_GetDiagnosticCommands, jmm_GetDiagnosticCommandInfo, jmm_GetDiagnosticCommandArgumentsInfo, ! jmm_ExecuteDiagnosticCommand, ! jmm_SetDiagnosticFrameworkNotificationEnabled }; #endif // INCLUDE_MANAGEMENT void* Management::get_jmm_interface(int version) { #if INCLUDE_MANAGEMENT