1 /* |
1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
42 // Implementation of "properties" command. |
42 // Implementation of "properties" command. |
43 // |
43 // |
44 // Invokes sun.misc.VMSupport.serializePropertiesToByteArray to serialize |
44 // Invokes sun.misc.VMSupport.serializePropertiesToByteArray to serialize |
45 // the system properties into a byte array. |
45 // the system properties into a byte array. |
46 |
46 |
47 static klassOop load_and_initialize_klass(Symbol* sh, TRAPS) { |
47 static Klass* load_and_initialize_klass(Symbol* sh, TRAPS) { |
48 klassOop k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL); |
48 Klass* k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL); |
49 instanceKlassHandle ik (THREAD, k); |
49 instanceKlassHandle ik (THREAD, k); |
50 if (ik->should_be_initialized()) { |
50 if (ik->should_be_initialized()) { |
51 ik->initialize(CHECK_NULL); |
51 ik->initialize(CHECK_NULL); |
52 } |
52 } |
53 return ik(); |
53 return ik(); |
57 Thread* THREAD = Thread::current(); |
57 Thread* THREAD = Thread::current(); |
58 HandleMark hm; |
58 HandleMark hm; |
59 |
59 |
60 // load sun.misc.VMSupport |
60 // load sun.misc.VMSupport |
61 Symbol* klass = vmSymbols::sun_misc_VMSupport(); |
61 Symbol* klass = vmSymbols::sun_misc_VMSupport(); |
62 klassOop k = load_and_initialize_klass(klass, THREAD); |
62 Klass* k = load_and_initialize_klass(klass, THREAD); |
63 if (HAS_PENDING_EXCEPTION) { |
63 if (HAS_PENDING_EXCEPTION) { |
64 java_lang_Throwable::print(PENDING_EXCEPTION, out); |
64 java_lang_Throwable::print(PENDING_EXCEPTION, out); |
65 CLEAR_PENDING_EXCEPTION; |
65 CLEAR_PENDING_EXCEPTION; |
66 return JNI_ERR; |
66 return JNI_ERR; |
67 } |
67 } |
454 } |
454 } |
455 |
455 |
456 // Starts the Attach Listener thread |
456 // Starts the Attach Listener thread |
457 void AttachListener::init() { |
457 void AttachListener::init() { |
458 EXCEPTION_MARK; |
458 EXCEPTION_MARK; |
459 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK); |
459 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK); |
460 instanceKlassHandle klass (THREAD, k); |
460 instanceKlassHandle klass (THREAD, k); |
461 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); |
461 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); |
462 |
462 |
463 const char thread_name[] = "Attach Listener"; |
463 const char thread_name[] = "Attach Listener"; |
464 Handle string = java_lang_String::create_from_str(thread_name, CHECK); |
464 Handle string = java_lang_String::create_from_str(thread_name, CHECK); |