< prev index next >

src/hotspot/share/services/diagnosticFramework.cpp

Print this page
rev 50538 : [mq]: jcmd-cleanups

@@ -249,11 +249,11 @@
     }
     arg = arg->next();
   }
 }
 
-void DCmdParser::print_help(outputStream* out, const char* cmd_name) {
+void DCmdParser::print_help(outputStream* out, const char* cmd_name) const {
   out->print("Syntax : %s %s", cmd_name, _options == NULL ? "" : "[options]");
   GenDCmdArgument* arg = _arguments_list;
   while (arg != NULL) {
     if (arg->is_mandatory()) {
       out->print(" <%s>", arg->name());

@@ -321,11 +321,11 @@
     arg->cleanup();
     arg = arg->next();
   }
 }
 
-int DCmdParser::num_arguments() {
+int DCmdParser::num_arguments() const {
   GenDCmdArgument* arg = _arguments_list;
   int count = 0;
   while (arg != NULL) {
     count++;
     arg = arg->next();

@@ -336,11 +336,11 @@
     arg = arg->next();
   }
   return count;
 }
 
-GrowableArray<const char *>* DCmdParser::argument_name_array() {
+GrowableArray<const char *>* DCmdParser::argument_name_array() const {
   int count = num_arguments();
   GrowableArray<const char *>* array = new GrowableArray<const char *>(count);
   GenDCmdArgument* arg = _arguments_list;
   while (arg != NULL) {
     array->append(arg->name());

@@ -352,11 +352,11 @@
     arg = arg->next();
   }
   return array;
 }
 
-GrowableArray<DCmdArgumentInfo*>* DCmdParser::argument_info_array() {
+GrowableArray<DCmdArgumentInfo*>* DCmdParser::argument_info_array() const {
   int count = num_arguments();
   GrowableArray<DCmdArgumentInfo*>* array = new GrowableArray<DCmdArgumentInfo *>(count);
   int idx = 0;
   GenDCmdArgument* arg = _arguments_list;
   while (arg != NULL) {

@@ -397,10 +397,11 @@
     CmdLine line = iter.next();
     if (line.is_stop()) {
       break;
     }
     if (line.is_executable()) {
+      ResourceMark rm;
       DCmd* command = DCmdFactory::create_local_DCmd(source, line, out, CHECK);
       assert(command != NULL, "command error must be handled before this line");
       DCmdMark mark(command);
       command->parse(&line, delim, CHECK);
       command->execute(source, CHECK);

@@ -411,11 +412,11 @@
 
 void DCmdWithParser::parse(CmdLine* line, char delim, TRAPS) {
   _dcmdparser.parse(line, delim, CHECK);
 }
 
-void DCmdWithParser::print_help(const char* name) {
+void DCmdWithParser::print_help(const char* name) const {
   _dcmdparser.print_help(output(), name);
 }
 
 void DCmdWithParser::reset(TRAPS) {
   _dcmdparser.reset(CHECK);

@@ -423,15 +424,15 @@
 
 void DCmdWithParser::cleanup() {
   _dcmdparser.cleanup();
 }
 
-GrowableArray<const char*>* DCmdWithParser::argument_name_array() {
+GrowableArray<const char*>* DCmdWithParser::argument_name_array() const {
   return _dcmdparser.argument_name_array();
 }
 
-GrowableArray<DCmdArgumentInfo*>* DCmdWithParser::argument_info_array() {
+GrowableArray<DCmdArgumentInfo*>* DCmdWithParser::argument_info_array() const {
   return _dcmdparser.argument_info_array();
 }
 
 void DCmdFactory::push_jmx_notification_request() {
   MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);

@@ -517,24 +518,10 @@
     DCmdFactory::push_jmx_notification_request();
   }
   return 0; // Actually, there's no checks for duplicates
 }
 
-DCmd* DCmdFactory::create_global_DCmd(DCmdSource source, CmdLine &line,
-                                      outputStream* out, TRAPS) {
-  DCmdFactory* f = factory(source, line.cmd_addr(), line.cmd_len());
-  if (f != NULL) {
-    if (f->is_enabled()) {
-      THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
-                     f->disabled_message());
-    }
-    return f->create_Cheap_instance(out);
-  }
-  THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
-             "Unknown diagnostic command");
-}
-
 DCmd* DCmdFactory::create_local_DCmd(DCmdSource source, CmdLine &line,
                                      outputStream* out, TRAPS) {
   DCmdFactory* f = factory(source, line.cmd_addr(), line.cmd_len());
   if (f != NULL) {
     if (!f->is_enabled()) {
< prev index next >