diff --git a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp index 5645ed396d8..1ff65aaf5c9 100644 --- a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp +++ b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp @@ -726,20 +726,21 @@ static bool check_exclusion_state_on_thread_start(JavaThread* jt) { return true; } -static JavaThread* get_native(jobject thread) { - ThreadsListHandle tlh; +static JavaThread* get_native(ThreadsListHandle& tlh, jobject thread) { JavaThread* native_thread = NULL; (void)tlh.cv_internal_thread_to_JavaThread(thread, &native_thread, NULL); return native_thread; } jlong JfrJavaSupport::jfr_thread_id(jobject thread) { - JavaThread* native_thread = get_native(thread); + ThreadsListHandle tlh; + JavaThread* native_thread = get_native(tlh, thread); return native_thread != NULL ? JFR_THREAD_ID(native_thread) : 0; } void JfrJavaSupport::exclude(jobject thread) { - JavaThread* native_thread = get_native(thread); + ThreadsListHandle tlh; + JavaThread* native_thread = get_native(tlh, thread); if (native_thread != NULL) { JfrThreadLocal::exclude(native_thread); } else { @@ -749,7 +750,8 @@ void JfrJavaSupport::exclude(jobject thread) { } void JfrJavaSupport::include(jobject thread) { - JavaThread* native_thread = get_native(thread); + ThreadsListHandle tlh; + JavaThread* native_thread = get_native(tlh, thread); if (native_thread != NULL) { JfrThreadLocal::include(native_thread); } else { @@ -759,7 +761,8 @@ void JfrJavaSupport::include(jobject thread) { } bool JfrJavaSupport::is_excluded(jobject thread) { - JavaThread* native_thread = get_native(thread); + ThreadsListHandle tlh; + JavaThread* native_thread = get_native(tlh, thread); return native_thread != NULL ? native_thread->jfr_thread_local()->is_excluded() : is_thread_excluded(thread); }