mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8373441: Remove DCmdFactory::_enabled
Reviewed-by: kevinw, fparain, jsjolen
This commit is contained in:
parent
87d881fee0
commit
3f07710270
@ -47,14 +47,14 @@
|
||||
|
||||
bool register_jfr_dcmds() {
|
||||
uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI | DCmd_Source_MBean;
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrCheckFlightRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrDumpFlightRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrStartFlightRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrStopFlightRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrCheckFlightRecordingDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrDumpFlightRecordingDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrStartFlightRecordingDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrStopFlightRecordingDCmd>(full_export));
|
||||
// JFR.query Uncomment when developing new queries for the JFR.view command
|
||||
// DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrQueryFlightRecordingDCmd>(full_export, true, true));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrViewFlightRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrConfigureFlightRecorderDCmd>(full_export, true, false));
|
||||
// DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrQueryFlightRecordingDCmd>(full_export, /*hidden=*/true));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrViewFlightRecordingDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrConfigureFlightRecorderDCmd>(full_export));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ LogDiagnosticCommand::LogDiagnosticCommand(outputStream* output, bool heap_alloc
|
||||
|
||||
void LogDiagnosticCommand::registerCommand() {
|
||||
uint32_t full_visibility = DCmd_Source_Internal | DCmd_Source_AttachAPI | DCmd_Source_MBean;
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<LogDiagnosticCommand>(full_visibility, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<LogDiagnosticCommand>(full_visibility));
|
||||
}
|
||||
|
||||
void LogDiagnosticCommand::execute(DCmdSource source, TRAPS) {
|
||||
|
||||
@ -98,78 +98,78 @@ void DCmd::register_dcmds(){
|
||||
// Third argument specifies if the command is hidden
|
||||
uint32_t full_export = DCmd_Source_Internal | DCmd_Source_AttachAPI
|
||||
| DCmd_Source_MBean;
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SetVMFlagDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMDynamicLibrariesDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMInfoDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapInfoDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<FinalizerInfoDCmd>(full_export));
|
||||
#if INCLUDE_SERVICES
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDictionaryDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHierarchyDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassesDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SymboltableDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<StringtableDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<metaspace::MetaspaceDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<EventLogDCmd>(full_export));
|
||||
#if INCLUDE_JVMTI // Both JVMTI and SERVICES have to be enabled to have this dcmd
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIAgentLoadDCmd>(full_export));
|
||||
#endif // INCLUDE_JVMTI
|
||||
#endif // INCLUDE_SERVICES
|
||||
#if INCLUDE_JVMTI
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export));
|
||||
#endif // INCLUDE_JVMTI
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export));
|
||||
#if INCLUDE_JVMTI
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export));
|
||||
#endif // INCLUDE_JVMTI
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadPollersDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export));
|
||||
#ifdef LINUX
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export));
|
||||
#endif // LINUX
|
||||
#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__)
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export));
|
||||
#endif // LINUX or WINDOWS or MacOS
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export));
|
||||
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesAddDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesRemoveDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesClearDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilationMemoryStatisticDCmd>(full_export));
|
||||
|
||||
// Enhanced JMX Agent Support
|
||||
// These commands not currently exported via the DiagnosticCommandMBean
|
||||
uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags));
|
||||
|
||||
#if INCLUDE_CDS
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndRecordingDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DumpSharedArchiveDCmd>(full_export));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<AOTEndRecordingDCmd>(full_export));
|
||||
#endif // INCLUDE_CDS
|
||||
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<NMTDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<NMTDCmd>(full_export));
|
||||
}
|
||||
|
||||
HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
|
||||
@ -192,8 +192,7 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
for (int i = 0; i < cmd_list->length(); i++) {
|
||||
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
|
||||
strlen(cmd_list->at(i)));
|
||||
output()->print_cr("%s%s", factory->name(),
|
||||
factory->is_enabled() ? "" : " [disabled]");
|
||||
output()->print_cr("%s", factory->name());
|
||||
output()->print_cr("\t%s", factory->description());
|
||||
output()->cr();
|
||||
factory = factory->next();
|
||||
@ -203,8 +202,7 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
DCmdFactory* factory = DCmdFactory::factory(source, _cmd.value(),
|
||||
strlen(_cmd.value()));
|
||||
if (factory != nullptr) {
|
||||
output()->print_cr("%s%s", factory->name(),
|
||||
factory->is_enabled() ? "" : " [disabled]");
|
||||
output()->print_cr("%s", factory->name());
|
||||
output()->print_cr("%s", factory->description());
|
||||
output()->print_cr("\nImpact: %s", factory->impact());
|
||||
output()->cr();
|
||||
@ -223,8 +221,7 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
for (int i = 0; i < cmd_list->length(); i++) {
|
||||
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
|
||||
strlen(cmd_list->at(i)));
|
||||
output()->print_cr("%s%s", factory->name(),
|
||||
factory->is_enabled() ? "" : " [disabled]");
|
||||
output()->print_cr("%s", factory->name());
|
||||
factory = factory->_next;
|
||||
}
|
||||
output()->print_cr("\nFor more information about a specific command use 'help <command>'.");
|
||||
|
||||
@ -563,10 +563,6 @@ DCmd* DCmdFactory::create_local_DCmd(DCmdSource source, CmdLine &line,
|
||||
outputStream* out, TRAPS) {
|
||||
DCmdFactory* f = factory(source, line.cmd_addr(), line.cmd_len());
|
||||
if (f != nullptr) {
|
||||
if (!f->is_enabled()) {
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
f->disabled_message());
|
||||
}
|
||||
return f->create_resource_instance(out);
|
||||
}
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
@ -594,8 +590,7 @@ GrowableArray<DCmdInfo*>* DCmdFactory::DCmdInfo_list(DCmdSource source ) {
|
||||
if (!factory->is_hidden() && (factory->export_flags() & source)) {
|
||||
array->append(new DCmdInfo(factory->name(),
|
||||
factory->description(), factory->impact(),
|
||||
factory->num_arguments(),
|
||||
factory->is_enabled()));
|
||||
factory->num_arguments()));
|
||||
}
|
||||
factory = factory->next();
|
||||
}
|
||||
|
||||
@ -117,21 +117,18 @@ protected:
|
||||
const char* const _description; /* Short description */
|
||||
const char* const _impact; /* Impact on the JVM */
|
||||
const int _num_arguments; /* Number of supported options or arguments */
|
||||
const bool _is_enabled; /* True if the diagnostic command can be invoked, false otherwise */
|
||||
public:
|
||||
DCmdInfo(const char* name,
|
||||
const char* description,
|
||||
const char* impact,
|
||||
int num_arguments,
|
||||
bool enabled)
|
||||
int num_arguments)
|
||||
: _name(name), _description(description), _impact(impact),
|
||||
_num_arguments(num_arguments), _is_enabled(enabled) {}
|
||||
_num_arguments(num_arguments) {}
|
||||
const char* name() const { return _name; }
|
||||
bool name_equals(const char* cmd_name) const;
|
||||
const char* description() const { return _description; }
|
||||
const char* impact() const { return _impact; }
|
||||
int num_arguments() const { return _num_arguments; }
|
||||
bool is_enabled() const { return _is_enabled; }
|
||||
};
|
||||
|
||||
// A DCmdArgumentInfo instance provides a description of a diagnostic command
|
||||
@ -233,8 +230,6 @@ public:
|
||||
// static const char* name() { return "<command name>";}
|
||||
// static const char* description() { return "<command help>";}
|
||||
|
||||
static const char* disabled_message() { return "Diagnostic command currently disabled"; }
|
||||
|
||||
// The impact() method returns a description of the intrusiveness of the diagnostic
|
||||
// command on the Java Virtual Machine behavior. The rational for this method is that some
|
||||
// diagnostic commands can seriously disrupt the behavior of the Java Virtual Machine
|
||||
@ -337,8 +332,7 @@ public:
|
||||
};
|
||||
|
||||
// Diagnostic commands are not directly instantiated but created with a factory.
|
||||
// Each diagnostic command class has its own factory. The DCmdFactory class also
|
||||
// manages the status of the diagnostic command (hidden, enabled). A DCmdFactory
|
||||
// Each diagnostic command class has its own factory. A DCmdFactory
|
||||
// has to be registered to make the diagnostic command available (see
|
||||
// management.cpp)
|
||||
class DCmdFactory: public CHeapObj<mtInternal> {
|
||||
@ -350,10 +344,6 @@ private:
|
||||
// Pointer to the next factory in the singly-linked list of registered
|
||||
// diagnostic commands
|
||||
DCmdFactory* _next;
|
||||
// When disabled, a diagnostic command cannot be executed. Any attempt to
|
||||
// execute it will result in the printing of the disabled message without
|
||||
// instantiating the command.
|
||||
const bool _enabled;
|
||||
// When hidden, a diagnostic command doesn't appear in the list of commands
|
||||
// provided by the 'help' command.
|
||||
const bool _hidden;
|
||||
@ -361,10 +351,9 @@ private:
|
||||
const int _num_arguments;
|
||||
|
||||
public:
|
||||
DCmdFactory(int num_arguments, uint32_t flags, bool enabled, bool hidden)
|
||||
: _next(nullptr), _enabled(enabled), _hidden(hidden),
|
||||
DCmdFactory(int num_arguments, uint32_t flags, bool hidden)
|
||||
: _next(nullptr), _hidden(hidden),
|
||||
_export_flags(flags), _num_arguments(num_arguments) {}
|
||||
bool is_enabled() const { return _enabled; }
|
||||
bool is_hidden() const { return _hidden; }
|
||||
uint32_t export_flags() const { return _export_flags; }
|
||||
int num_arguments() const { return _num_arguments; }
|
||||
@ -373,11 +362,8 @@ public:
|
||||
virtual const char* name() const = 0;
|
||||
virtual const char* description() const = 0;
|
||||
virtual const char* impact() const = 0;
|
||||
virtual const char* disabled_message() const = 0;
|
||||
// Register a DCmdFactory to make a diagnostic command available.
|
||||
// Once registered, a diagnostic command must not be unregistered.
|
||||
// To prevent a diagnostic command from being executed, just set the
|
||||
// enabled flag to false.
|
||||
static int register_DCmdFactory(DCmdFactory* factory);
|
||||
static DCmdFactory* factory(DCmdSource source, const char* cmd, size_t len);
|
||||
// Returns a resourceArea allocated diagnostic command for the given command line
|
||||
@ -401,8 +387,8 @@ private:
|
||||
// where this template is used to create and register factories.
|
||||
template <class DCmdClass> class DCmdFactoryImpl : public DCmdFactory {
|
||||
public:
|
||||
DCmdFactoryImpl(uint32_t flags, bool enabled, bool hidden) :
|
||||
DCmdFactory(get_num_arguments<DCmdClass>(), flags, enabled, hidden) { }
|
||||
DCmdFactoryImpl(uint32_t flags, bool hidden = false) :
|
||||
DCmdFactory(get_num_arguments<DCmdClass>(), flags, hidden) { }
|
||||
// Returns a resourceArea allocated instance
|
||||
DCmd* create_resource_instance(outputStream* output) const {
|
||||
return new DCmdClass(output, false);
|
||||
@ -416,9 +402,6 @@ public:
|
||||
const char* impact() const {
|
||||
return DCmdClass::impact();
|
||||
}
|
||||
const char* disabled_message() const {
|
||||
return DCmdClass::disabled_message();
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef ASSERT
|
||||
|
||||
@ -2032,7 +2032,11 @@ JVM_ENTRY(void, jmm_GetDiagnosticCommandInfo(JNIEnv *env, jobjectArray cmds,
|
||||
infoArray[i].description = info->description();
|
||||
infoArray[i].impact = info->impact();
|
||||
infoArray[i].num_arguments = info->num_arguments();
|
||||
infoArray[i].enabled = info->is_enabled();
|
||||
|
||||
// All registered DCmds are always enabled. We set the dcmdInfo::enabled
|
||||
// field to true to be compatible with the Java API
|
||||
// com.sun.management.internal.DiagnosticCommandInfo.
|
||||
infoArray[i].enabled = true;
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -135,7 +135,7 @@ import javax.management.DynamicMBean;
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">dcmd.enabled</th><td>boolean</td>
|
||||
* <td>True if the diagnostic command is enabled, false otherwise</td>
|
||||
* <td>This field is always true -- diagnostic commands cannot be disabled.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">dcmd.arguments</th><td>Descriptor</td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user