--- old/src/hotspot/share/prims/jvmtiEventController.cpp Wed Nov 8 08:12:51 2017 +++ new/src/hotspot/share/prims/jvmtiEventController.cpp Wed Nov 8 08:12:51 2017 @@ -581,9 +581,7 @@ // filtered events and there weren't last time if ( (any_env_thread_enabled & THREAD_FILTERED_EVENT_BITS) != 0 && (was_any_env_thread_enabled & THREAD_FILTERED_EVENT_BITS) == 0) { - ThreadsListHandle tlh; - JavaThreadIterator jti(tlh.list()); - for (JavaThread *tp = jti.first(); tp != NULL; tp = jti.next()) { + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *tp = jtiwh.next(); ) { // state_for_while_locked() makes tp->is_exiting() check JvmtiThreadState::state_for_while_locked(tp); // create the thread state if missing }