Mercurial > hg > truffle
annotate src/share/vm/services/diagnosticCommand.cpp @ 7956:16fb9f942703
6479360: PrintClassHistogram improvements
Summary: jcmd <pid> GC.class_stats (UnlockDiagnosticVMOptions)
Reviewed-by: coleenp, hseigel, sla, acorn
Contributed-by: ioi.lam@oracle.com
author | acorn |
---|---|
date | Fri, 25 Jan 2013 15:06:18 -0500 |
parents | 9855b7e559ae |
children | 8f696cf1a0fb |
rev | line source |
---|---|
4133 | 1 /* |
7956 | 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
4133 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 #include "precompiled.hpp" | |
4773 | 26 #include "gc_implementation/shared/vmGCOperations.hpp" |
27 #include "runtime/javaCalls.hpp" | |
4133 | 28 #include "services/diagnosticArgument.hpp" |
29 #include "services/diagnosticCommand.hpp" | |
30 #include "services/diagnosticFramework.hpp" | |
4773 | 31 #include "services/heapDumper.hpp" |
32 #include "services/management.hpp" | |
4133 | 33 |
4851
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
34 void DCmdRegistrant::register_dcmds(){ |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
35 // Registration of the diagnostic commands |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
36 // First boolean argument specifies if the command is enabled |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
37 // Second boolean argument specifies if the command is hidden |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
38 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HelpDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
39 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VersionDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
40 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CommandLineDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
41 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintSystemPropertiesDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
42 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PrintVMFlagsDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
43 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VMUptimeDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
44 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(true, false)); |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
45 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(true, false)); |
7956 | 46 #if INCLUDE_SERVICES // Heap dumping/inspection supported |
4851
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
47 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(true, false)); |
7956 | 48 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(true, false)); |
49 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(true, false)); | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6725
diff
changeset
|
50 #endif // INCLUDE_SERVICES |
4851
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
51 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(true, false)); |
5895
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
52 //Enhanced JMX Agent Support |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
53 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(true,false)); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
54 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(true,false)); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
55 DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(true,false)); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
56 |
4851
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
57 } |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
58 |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
59 #ifndef HAVE_EXTRA_DCMD |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
60 void DCmdRegistrant::register_dcmds_ext(){ |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
61 // Do nothing here |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
62 } |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
63 #endif |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
64 |
a42c07c38c47
7132515: Add dcmd to manage UnlockingCommercialFeature flag
dsamersoff
parents:
4773
diff
changeset
|
65 |
4773 | 66 HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), |
4133 | 67 _all("-all", "Show help for all commands", "BOOLEAN", false, "false"), |
68 _cmd("command name", "The name of the command for which we want help", | |
69 "STRING", false) { | |
70 _dcmdparser.add_dcmd_option(&_all); | |
71 _dcmdparser.add_dcmd_argument(&_cmd); | |
72 }; | |
73 | |
74 void HelpDCmd::execute(TRAPS) { | |
75 if (_all.value()) { | |
76 GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(); | |
77 for (int i = 0; i < cmd_list->length(); i++) { | |
78 DCmdFactory* factory = DCmdFactory::factory(cmd_list->at(i), | |
79 strlen(cmd_list->at(i))); | |
80 if (!factory->is_hidden()) { | |
81 output()->print_cr("%s%s", factory->name(), | |
82 factory->is_enabled() ? "" : " [disabled]"); | |
83 output()->print_cr("\t%s", factory->description()); | |
84 output()->cr(); | |
85 } | |
86 factory = factory->next(); | |
87 } | |
88 } else if (_cmd.has_value()) { | |
89 DCmd* cmd = NULL; | |
90 DCmdFactory* factory = DCmdFactory::factory(_cmd.value(), | |
91 strlen(_cmd.value())); | |
92 if (factory != NULL) { | |
93 output()->print_cr("%s%s", factory->name(), | |
94 factory->is_enabled() ? "" : " [disabled]"); | |
95 output()->print_cr(factory->description()); | |
96 output()->print_cr("\nImpact: %s", factory->impact()); | |
4773 | 97 output()->cr(); |
4133 | 98 cmd = factory->create_resource_instance(output()); |
99 if (cmd != NULL) { | |
100 DCmdMark mark(cmd); | |
4773 | 101 cmd->print_help(factory->name()); |
4133 | 102 } |
103 } else { | |
104 output()->print_cr("Help unavailable : '%s' : No such command", _cmd.value()); | |
105 } | |
106 } else { | |
107 output()->print_cr("The following commands are available:"); | |
108 GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(); | |
109 for (int i = 0; i < cmd_list->length(); i++) { | |
110 DCmdFactory* factory = DCmdFactory::factory(cmd_list->at(i), | |
111 strlen(cmd_list->at(i))); | |
112 if (!factory->is_hidden()) { | |
113 output()->print_cr("%s%s", factory->name(), | |
114 factory->is_enabled() ? "" : " [disabled]"); | |
115 } | |
116 factory = factory->_next; | |
117 } | |
118 output()->print_cr("\nFor more information about a specific command use 'help <command>'."); | |
119 } | |
120 } | |
121 | |
122 int HelpDCmd::num_arguments() { | |
123 ResourceMark rm; | |
124 HelpDCmd* dcmd = new HelpDCmd(NULL, false); | |
125 if (dcmd != NULL) { | |
126 DCmdMark mark(dcmd); | |
127 return dcmd->_dcmdparser.num_arguments(); | |
128 } else { | |
129 return 0; | |
130 } | |
131 } | |
132 | |
133 void VersionDCmd::execute(TRAPS) { | |
134 output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(), | |
135 Abstract_VM_Version::vm_release()); | |
136 JDK_Version jdk_version = JDK_Version::current(); | |
137 if (jdk_version.update_version() > 0) { | |
138 output()->print_cr("JDK %d.%d_%02d", jdk_version.major_version(), | |
139 jdk_version.minor_version(), jdk_version.update_version()); | |
140 } else { | |
141 output()->print_cr("JDK %d.%d", jdk_version.major_version(), | |
142 jdk_version.minor_version()); | |
143 } | |
144 } | |
4773 | 145 |
146 PrintVMFlagsDCmd::PrintVMFlagsDCmd(outputStream* output, bool heap) : | |
147 DCmdWithParser(output, heap), | |
148 _all("-all", "Print all flags supported by the VM", "BOOLEAN", false, "false") { | |
149 _dcmdparser.add_dcmd_option(&_all); | |
150 } | |
151 | |
152 void PrintVMFlagsDCmd::execute(TRAPS) { | |
153 if (_all.value()) { | |
154 CommandLineFlags::printFlags(output(), true); | |
155 } else { | |
156 CommandLineFlags::printSetFlags(output()); | |
157 } | |
158 } | |
159 | |
160 int PrintVMFlagsDCmd::num_arguments() { | |
161 ResourceMark rm; | |
162 PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false); | |
163 if (dcmd != NULL) { | |
164 DCmdMark mark(dcmd); | |
165 return dcmd->_dcmdparser.num_arguments(); | |
166 } else { | |
167 return 0; | |
168 } | |
169 } | |
170 | |
171 void PrintSystemPropertiesDCmd::execute(TRAPS) { | |
172 // load sun.misc.VMSupport | |
173 Symbol* klass = vmSymbols::sun_misc_VMSupport(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5895
diff
changeset
|
174 Klass* k = SystemDictionary::resolve_or_fail(klass, true, CHECK); |
4773 | 175 instanceKlassHandle ik (THREAD, k); |
176 if (ik->should_be_initialized()) { | |
177 ik->initialize(THREAD); | |
178 } | |
179 if (HAS_PENDING_EXCEPTION) { | |
180 java_lang_Throwable::print(PENDING_EXCEPTION, output()); | |
181 output()->cr(); | |
182 CLEAR_PENDING_EXCEPTION; | |
183 return; | |
184 } | |
185 | |
186 // invoke the serializePropertiesToByteArray method | |
187 JavaValue result(T_OBJECT); | |
188 JavaCallArguments args; | |
189 | |
190 Symbol* signature = vmSymbols::serializePropertiesToByteArray_signature(); | |
191 JavaCalls::call_static(&result, | |
192 ik, | |
193 vmSymbols::serializePropertiesToByteArray_name(), | |
194 signature, | |
195 &args, | |
196 THREAD); | |
197 if (HAS_PENDING_EXCEPTION) { | |
198 java_lang_Throwable::print(PENDING_EXCEPTION, output()); | |
199 output()->cr(); | |
200 CLEAR_PENDING_EXCEPTION; | |
201 return; | |
202 } | |
203 | |
204 // The result should be a [B | |
205 oop res = (oop)result.get_jobject(); | |
206 assert(res->is_typeArray(), "just checking"); | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
207 assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking"); |
4773 | 208 |
209 // copy the bytes to the output stream | |
210 typeArrayOop ba = typeArrayOop(res); | |
211 jbyte* addr = typeArrayOop(res)->byte_at_addr(0); | |
212 output()->print_raw((const char*)addr, ba->length()); | |
213 } | |
214 | |
215 VMUptimeDCmd::VMUptimeDCmd(outputStream* output, bool heap) : | |
216 DCmdWithParser(output, heap), | |
217 _date("-date", "Add a prefix with current date", "BOOLEAN", false, "false") { | |
218 _dcmdparser.add_dcmd_option(&_date); | |
219 } | |
220 | |
221 void VMUptimeDCmd::execute(TRAPS) { | |
222 if (_date.value()) { | |
223 output()->date_stamp(true, "", ": "); | |
224 } | |
225 output()->time_stamp().update_to(tty->time_stamp().ticks()); | |
226 output()->stamp(); | |
227 output()->print_cr(" s"); | |
228 } | |
229 | |
230 int VMUptimeDCmd::num_arguments() { | |
231 ResourceMark rm; | |
232 VMUptimeDCmd* dcmd = new VMUptimeDCmd(NULL, false); | |
233 if (dcmd != NULL) { | |
234 DCmdMark mark(dcmd); | |
235 return dcmd->_dcmdparser.num_arguments(); | |
236 } else { | |
237 return 0; | |
238 } | |
239 } | |
240 | |
241 void SystemGCDCmd::execute(TRAPS) { | |
242 Universe::heap()->collect(GCCause::_java_lang_system_gc); | |
243 } | |
244 | |
245 void RunFinalizationDCmd::execute(TRAPS) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5895
diff
changeset
|
246 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), |
4773 | 247 true, CHECK); |
248 instanceKlassHandle klass(THREAD, k); | |
249 JavaValue result(T_VOID); | |
250 JavaCalls::call_static(&result, klass, | |
251 vmSymbols::run_finalization_name(), | |
252 vmSymbols::void_method_signature(), CHECK); | |
253 } | |
254 | |
7956 | 255 #if INCLUDE_SERVICES // Heap dumping/inspection supported |
4773 | 256 HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) : |
257 DCmdWithParser(output, heap), | |
258 _filename("filename","Name of the dump file", "STRING",true), | |
259 _all("-all", "Dump all objects, including unreachable objects", | |
260 "BOOLEAN", false, "false") { | |
261 _dcmdparser.add_dcmd_option(&_all); | |
262 _dcmdparser.add_dcmd_argument(&_filename); | |
263 } | |
264 | |
265 void HeapDumpDCmd::execute(TRAPS) { | |
266 // Request a full GC before heap dump if _all is false | |
267 // This helps reduces the amount of unreachable objects in the dump | |
268 // and makes it easier to browse. | |
269 HeapDumper dumper(!_all.value() /* request GC if _all is false*/); | |
270 int res = dumper.dump(_filename.value()); | |
271 if (res == 0) { | |
272 output()->print_cr("Heap dump file created"); | |
273 } else { | |
274 // heap dump failed | |
275 ResourceMark rm; | |
276 char* error = dumper.error_as_C_string(); | |
277 if (error == NULL) { | |
278 output()->print_cr("Dump failed - reason unknown"); | |
279 } else { | |
280 output()->print_cr("%s", error); | |
281 } | |
282 } | |
283 } | |
284 | |
285 int HeapDumpDCmd::num_arguments() { | |
286 ResourceMark rm; | |
287 HeapDumpDCmd* dcmd = new HeapDumpDCmd(NULL, false); | |
288 if (dcmd != NULL) { | |
289 DCmdMark mark(dcmd); | |
290 return dcmd->_dcmdparser.num_arguments(); | |
291 } else { | |
292 return 0; | |
293 } | |
294 } | |
295 | |
296 ClassHistogramDCmd::ClassHistogramDCmd(outputStream* output, bool heap) : | |
297 DCmdWithParser(output, heap), | |
298 _all("-all", "Inspect all objects, including unreachable objects", | |
299 "BOOLEAN", false, "false") { | |
300 _dcmdparser.add_dcmd_option(&_all); | |
301 } | |
302 | |
303 void ClassHistogramDCmd::execute(TRAPS) { | |
304 VM_GC_HeapInspection heapop(output(), | |
305 !_all.value() /* request full gc if false */, | |
306 true /* need_prologue */); | |
307 VMThread::execute(&heapop); | |
308 } | |
309 | |
310 int ClassHistogramDCmd::num_arguments() { | |
311 ResourceMark rm; | |
312 ClassHistogramDCmd* dcmd = new ClassHistogramDCmd(NULL, false); | |
313 if (dcmd != NULL) { | |
314 DCmdMark mark(dcmd); | |
315 return dcmd->_dcmdparser.num_arguments(); | |
316 } else { | |
317 return 0; | |
318 } | |
319 } | |
320 | |
7956 | 321 #define DEFAULT_COLUMNS "InstBytes,KlassBytes,CpAll,annotations,MethodCount,Bytecodes,MethodAll,ROAll,RWAll,Total" |
322 ClassStatsDCmd::ClassStatsDCmd(outputStream* output, bool heap) : | |
323 DCmdWithParser(output, heap), | |
324 _csv("-csv", "Print in CSV (comma-separated values) format for spreadsheets", | |
325 "BOOLEAN", false, "false"), | |
326 _all("-all", "Show all columns", | |
327 "BOOLEAN", false, "false"), | |
328 _help("-help", "Show meaning of all the columns", | |
329 "BOOLEAN", false, "false"), | |
330 _columns("columns", "Comma-separated list of all the columns to show. " | |
331 "If not specified, the following columns are shown: " DEFAULT_COLUMNS, | |
332 "STRING", false) { | |
333 _dcmdparser.add_dcmd_option(&_all); | |
334 _dcmdparser.add_dcmd_option(&_csv); | |
335 _dcmdparser.add_dcmd_option(&_help); | |
336 _dcmdparser.add_dcmd_argument(&_columns); | |
337 } | |
338 | |
339 void ClassStatsDCmd::execute(TRAPS) { | |
340 if (!UnlockDiagnosticVMOptions) { | |
341 output()->print_cr("GC.class_stats command requires -XX:+UnlockDiagnosticVMOptions"); | |
342 return; | |
343 } | |
344 | |
345 VM_GC_HeapInspection heapop(output(), | |
346 true, /* request_full_gc */ | |
347 true /* need_prologue */); | |
348 heapop.set_csv_format(_csv.value()); | |
349 heapop.set_print_help(_help.value()); | |
350 heapop.set_print_class_stats(true); | |
351 if (_all.value()) { | |
352 if (_columns.has_value()) { | |
353 output()->print_cr("Cannot specify -all and individual columns at the same time"); | |
354 return; | |
355 } else { | |
356 heapop.set_columns(NULL); | |
357 } | |
358 } else { | |
359 if (_columns.has_value()) { | |
360 heapop.set_columns(_columns.value()); | |
361 } else { | |
362 heapop.set_columns(DEFAULT_COLUMNS); | |
363 } | |
364 } | |
365 VMThread::execute(&heapop); | |
366 } | |
367 | |
368 int ClassStatsDCmd::num_arguments() { | |
369 ResourceMark rm; | |
370 ClassStatsDCmd* dcmd = new ClassStatsDCmd(NULL, false); | |
371 if (dcmd != NULL) { | |
372 DCmdMark mark(dcmd); | |
373 return dcmd->_dcmdparser.num_arguments(); | |
374 } else { | |
375 return 0; | |
376 } | |
377 } | |
378 #endif // INCLUDE_SERVICES | |
379 | |
4773 | 380 ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) : |
381 DCmdWithParser(output, heap), | |
382 _locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false") { | |
383 _dcmdparser.add_dcmd_option(&_locks); | |
384 } | |
385 | |
386 void ThreadDumpDCmd::execute(TRAPS) { | |
387 // thread stacks | |
388 VM_PrintThreads op1(output(), _locks.value()); | |
389 VMThread::execute(&op1); | |
390 | |
391 // JNI global handles | |
392 VM_PrintJNI op2(output()); | |
393 VMThread::execute(&op2); | |
394 | |
395 // Deadlock detection | |
396 VM_FindDeadlocks op3(output()); | |
397 VMThread::execute(&op3); | |
398 } | |
399 | |
400 int ThreadDumpDCmd::num_arguments() { | |
401 ResourceMark rm; | |
402 ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false); | |
403 if (dcmd != NULL) { | |
404 DCmdMark mark(dcmd); | |
405 return dcmd->_dcmdparser.num_arguments(); | |
406 } else { | |
407 return 0; | |
408 } | |
409 } | |
5895
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
410 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
411 // Enhanced JMX Agent support |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
412 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
413 JMXStartRemoteDCmd::JMXStartRemoteDCmd(outputStream *output, bool heap_allocated) : |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
414 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
415 DCmdWithParser(output, heap_allocated), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
416 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
417 _config_file |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
418 ("config.file", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
419 "set com.sun.management.config.file", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
420 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
421 _jmxremote_port |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
422 ("jmxremote.port", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
423 "set com.sun.management.jmxremote.port", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
424 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
425 _jmxremote_rmi_port |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
426 ("jmxremote.rmi.port", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
427 "set com.sun.management.jmxremote.rmi.port", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
428 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
429 _jmxremote_ssl |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
430 ("jmxremote.ssl", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
431 "set com.sun.management.jmxremote.ssl", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
432 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
433 _jmxremote_registry_ssl |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
434 ("jmxremote.registry.ssl", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
435 "set com.sun.management.jmxremote.registry.ssl", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
436 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
437 _jmxremote_authenticate |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
438 ("jmxremote.authenticate", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
439 "set com.sun.management.jmxremote.authenticate", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
440 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
441 _jmxremote_password_file |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
442 ("jmxremote.password.file", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
443 "set com.sun.management.jmxremote.password.file", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
444 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
445 _jmxremote_access_file |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
446 ("jmxremote.access.file", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
447 "set com.sun.management.jmxremote.access.file", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
448 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
449 _jmxremote_login_config |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
450 ("jmxremote.login.config", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
451 "set com.sun.management.jmxremote.login.config", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
452 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
453 _jmxremote_ssl_enabled_cipher_suites |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
454 ("jmxremote.ssl.enabled.cipher.suites", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
455 "set com.sun.management.jmxremote.ssl.enabled.cipher.suite", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
456 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
457 _jmxremote_ssl_enabled_protocols |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
458 ("jmxremote.ssl.enabled.protocols", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
459 "set com.sun.management.jmxremote.ssl.enabled.protocols", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
460 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
461 _jmxremote_ssl_need_client_auth |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
462 ("jmxremote.ssl.need.client.auth", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
463 "set com.sun.management.jmxremote.need.client.auth", "STRING", false), |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
464 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
465 _jmxremote_ssl_config_file |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
466 ("jmxremote.ssl.config.file", |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
467 "set com.sun.management.jmxremote.ssl_config_file", "STRING", false) |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
468 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
469 { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
470 _dcmdparser.add_dcmd_option(&_config_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
471 _dcmdparser.add_dcmd_option(&_jmxremote_port); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
472 _dcmdparser.add_dcmd_option(&_jmxremote_rmi_port); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
473 _dcmdparser.add_dcmd_option(&_jmxremote_ssl); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
474 _dcmdparser.add_dcmd_option(&_jmxremote_registry_ssl); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
475 _dcmdparser.add_dcmd_option(&_jmxremote_authenticate); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
476 _dcmdparser.add_dcmd_option(&_jmxremote_password_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
477 _dcmdparser.add_dcmd_option(&_jmxremote_access_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
478 _dcmdparser.add_dcmd_option(&_jmxremote_login_config); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
479 _dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_cipher_suites); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
480 _dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_protocols); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
481 _dcmdparser.add_dcmd_option(&_jmxremote_ssl_need_client_auth); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
482 _dcmdparser.add_dcmd_option(&_jmxremote_ssl_config_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
483 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
484 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
485 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
486 int JMXStartRemoteDCmd::num_arguments() { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
487 ResourceMark rm; |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
488 JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
489 if (dcmd != NULL) { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
490 DCmdMark mark(dcmd); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
491 return dcmd->_dcmdparser.num_arguments(); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
492 } else { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
493 return 0; |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
494 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
495 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
496 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
497 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
498 void JMXStartRemoteDCmd::execute(TRAPS) { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
499 ResourceMark rm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
500 HandleMark hm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
501 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
502 // Load and initialize the sun.management.Agent class |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
503 // invoke startRemoteManagementAgent(string) method to start |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
504 // the remote management server. |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
505 // throw java.lang.NoSuchMethodError if the method doesn't exist |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
506 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
507 Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5895
diff
changeset
|
508 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
5895
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
509 instanceKlassHandle ik (THREAD, k); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
510 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
511 JavaValue result(T_VOID); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
512 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
513 // Pass all command line arguments to java as key=value,... |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
514 // All checks are done on java side |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
515 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
516 int len = 0; |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
517 stringStream options; |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
518 char comma[2] = {0,0}; |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
519 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
520 // Leave default values on Agent.class side and pass only |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
521 // agruments explicitly set by user. All arguments passed |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
522 // to jcmd override properties with the same name set by |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
523 // command line with -D or by managmenent.properties |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
524 // file. |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
525 #define PUT_OPTION(a) \ |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
526 if ( (a).is_set() ){ \ |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
527 options.print("%scom.sun.management.%s=%s", comma, (a).name(), (a).value()); \ |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
528 comma[0] = ','; \ |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
529 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
530 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
531 PUT_OPTION(_config_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
532 PUT_OPTION(_jmxremote_port); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
533 PUT_OPTION(_jmxremote_rmi_port); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
534 PUT_OPTION(_jmxremote_ssl); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
535 PUT_OPTION(_jmxremote_registry_ssl); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
536 PUT_OPTION(_jmxremote_authenticate); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
537 PUT_OPTION(_jmxremote_password_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
538 PUT_OPTION(_jmxremote_access_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
539 PUT_OPTION(_jmxremote_login_config); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
540 PUT_OPTION(_jmxremote_ssl_enabled_cipher_suites); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
541 PUT_OPTION(_jmxremote_ssl_enabled_protocols); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
542 PUT_OPTION(_jmxremote_ssl_need_client_auth); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
543 PUT_OPTION(_jmxremote_ssl_config_file); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
544 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
545 #undef PUT_OPTION |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
546 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
547 Handle str = java_lang_String::create_from_str(options.as_string(), CHECK); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
548 JavaCalls::call_static(&result, ik, vmSymbols::startRemoteAgent_name(), vmSymbols::string_void_signature(), str, CHECK); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
549 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
550 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
551 JMXStartLocalDCmd::JMXStartLocalDCmd(outputStream *output, bool heap_allocated) : |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
552 DCmd(output, heap_allocated) |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
553 { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
554 // do nothing |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
555 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
556 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
557 void JMXStartLocalDCmd::execute(TRAPS) { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
558 ResourceMark rm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
559 HandleMark hm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
560 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
561 // Load and initialize the sun.management.Agent class |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
562 // invoke startLocalManagementAgent(void) method to start |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
563 // the local management server |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
564 // throw java.lang.NoSuchMethodError if method doesn't exist |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
565 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
566 Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5895
diff
changeset
|
567 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
5895
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
568 instanceKlassHandle ik (THREAD, k); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
569 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
570 JavaValue result(T_VOID); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
571 JavaCalls::call_static(&result, ik, vmSymbols::startLocalAgent_name(), vmSymbols::void_method_signature(), CHECK); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
572 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
573 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
574 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
575 void JMXStopRemoteDCmd::execute(TRAPS) { |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
576 ResourceMark rm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
577 HandleMark hm(THREAD); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
578 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
579 // Load and initialize the sun.management.Agent class |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
580 // invoke stopRemoteManagementAgent method to stop the |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
581 // management server |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
582 // throw java.lang.NoSuchMethodError if method doesn't exist |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
583 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
584 Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5895
diff
changeset
|
585 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::sun_management_Agent(), loader, Handle(), true, CHECK); |
5895
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
586 instanceKlassHandle ik (THREAD, k); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
587 |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
588 JavaValue result(T_VOID); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
589 JavaCalls::call_static(&result, ik, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK); |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
590 } |
645162d94294
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
4851
diff
changeset
|
591 |