@@ -726,20 +726,21 @@ static bool check_exclusion_state_on_thread_start(JavaThread* jt) {
726726 return true ;
727727}
728728
729- static JavaThread* get_native (jobject thread) {
730- ThreadsListHandle tlh;
729+ static JavaThread* get_native (ThreadsListHandle& tlh, jobject thread) {
731730 JavaThread* native_thread = NULL ;
732731 (void )tlh.cv_internal_thread_to_JavaThread (thread, &native_thread, NULL );
733732 return native_thread;
734733}
735734
736735jlong JfrJavaSupport::jfr_thread_id (jobject thread) {
737- JavaThread* native_thread = get_native (thread);
736+ ThreadsListHandle tlh;
737+ JavaThread* native_thread = get_native (tlh, thread);
738738 return native_thread != NULL ? JFR_THREAD_ID (native_thread) : 0 ;
739739}
740740
741741void JfrJavaSupport::exclude (jobject thread) {
742- JavaThread* native_thread = get_native (thread);
742+ ThreadsListHandle tlh;
743+ JavaThread* native_thread = get_native (tlh, thread);
743744 if (native_thread != NULL ) {
744745 JfrThreadLocal::exclude (native_thread);
745746 } else {
@@ -749,7 +750,8 @@ void JfrJavaSupport::exclude(jobject thread) {
749750}
750751
751752void JfrJavaSupport::include (jobject thread) {
752- JavaThread* native_thread = get_native (thread);
753+ ThreadsListHandle tlh;
754+ JavaThread* native_thread = get_native (tlh, thread);
753755 if (native_thread != NULL ) {
754756 JfrThreadLocal::include (native_thread);
755757 } else {
@@ -759,7 +761,8 @@ void JfrJavaSupport::include(jobject thread) {
759761}
760762
761763bool JfrJavaSupport::is_excluded (jobject thread) {
762- JavaThread* native_thread = get_native (thread);
764+ ThreadsListHandle tlh;
765+ JavaThread* native_thread = get_native (tlh, thread);
763766 return native_thread != NULL ? native_thread->jfr_thread_local ()->is_excluded () : is_thread_excluded (thread);
764767}
765768
0 commit comments