< prev index next >
src/hotspot/share/services/attachListener.cpp
Print this page
@@ -43,11 +43,11 @@
#include "services/heapDumper.hpp"
#include "services/writeableFlags.hpp"
#include "utilities/debug.hpp"
#include "utilities/formatBuffer.hpp"
-volatile bool AttachListener::_initialized;
+volatile AttachListenerState AttachListener::_state = AL_NOT_INITIALIZED;
// Implementation of "properties" command.
//
// Invokes VMSupport.serializePropertiesToByteArray to serialize
// the system properties into a byte array.
@@ -370,17 +370,19 @@
assert(thread == Thread::current(), "Must be");
assert(thread->stack_base() != NULL && thread->stack_size() > 0,
"Should already be setup");
if (AttachListener::pd_init() != 0) {
+ AttachListener::set_state(AL_NOT_INITIALIZED);
return;
}
AttachListener::set_initialized();
for (;;) {
AttachOperation* op = AttachListener::dequeue();
if (op == NULL) {
+ AttachListener::set_state(AL_NOT_INITIALIZED);
return; // dequeue failed or shutdown
}
ResourceMark rm;
bufferedStream st;
@@ -420,10 +422,12 @@
}
// operation complete - send result and output to client
op->complete(res, &st);
}
+
+ AttachListener::set_state(AL_NOT_INITIALIZED);
}
bool AttachListener::has_init_error(TRAPS) {
if (HAS_PENDING_EXCEPTION) {
tty->print_cr("Exception in VM (AttachListener::init) : ");
@@ -443,10 +447,11 @@
EXCEPTION_MARK;
const char thread_name[] = "Attach Listener";
Handle string = java_lang_String::create_from_str(thread_name, THREAD);
if (has_init_error(THREAD)) {
+ set_state(AL_NOT_INITIALIZED);
return;
}
// Initialize thread_oop to put it into the system threadGroup
Handle thread_group (THREAD, Universe::system_thread_group());
@@ -454,10 +459,11 @@
vmSymbols::threadgroup_string_void_signature(),
thread_group,
string,
THREAD);
if (has_init_error(THREAD)) {
+ set_state(AL_NOT_INITIALIZED);
return;
}
Klass* group = SystemDictionary::ThreadGroup_klass();
JavaValue result(T_VOID);
@@ -467,10 +473,11 @@
vmSymbols::add_method_name(),
vmSymbols::thread_void_signature(),
thread_oop,
THREAD);
if (has_init_error(THREAD)) {
+ set_state(AL_NOT_INITIALIZED);
return;
}
{ MutexLocker mu(Threads_lock);
JavaThread* listener_thread = new JavaThread(&attach_listener_thread_entry);
< prev index next >