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