--- old/src/share/vm/services/attachListener.cpp 2021-10-08 17:44:03.943587384 +0800 +++ new/src/share/vm/services/attachListener.cpp 2021-10-08 17:44:03.774580973 +0800 @@ -37,7 +37,7 @@ #include "services/diagnosticCommand.hpp" #include "services/heapDumper.hpp" -volatile bool AttachListener::_initialized; +volatile AttachListenerState AttachListener::_state = AL_NOT_INITIALIZED; // Implementation of "properties" command. // @@ -418,6 +418,7 @@ thread->record_stack_base_and_size(); if (AttachListener::pd_init() != 0) { + AttachListener::set_state(AL_NOT_INITIALIZED); return; } AttachListener::set_initialized(); @@ -425,6 +426,7 @@ for (;;) { AttachOperation* op = AttachListener::dequeue(); if (op == NULL) { + AttachListener::set_state(AL_NOT_INITIALIZED); return; // dequeue failed or shutdown } @@ -464,6 +466,8 @@ // operation complete - send result and output to client op->complete(res, &st); } + + ShouldNotReachHere(); } bool AttachListener::has_init_error(TRAPS) { @@ -497,6 +501,7 @@ 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; } @@ -512,6 +517,7 @@ THREAD); if (has_init_error(THREAD)) { + set_state(AL_NOT_INITIALIZED); return; } @@ -524,6 +530,7 @@ thread_oop, // ARG 1 THREAD); if (has_init_error(THREAD)) { + set_state(AL_NOT_INITIALIZED); return; }