diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index 45c82d5ba45..144533cd959 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -1938,8 +1938,10 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { { ThreadBlockInVM tbvm(current, true); } - - JvmtiExport::post_monitor_waited(current, this, ret == OS_TIMEOUT); + // Re-check the condition as the monitor waited events can be disabled whilst thread was suspended. + if (JvmtiExport::should_post_monitor_waited()) { + JvmtiExport::post_monitor_waited(current, this, ret == OS_TIMEOUT); + } } if (wait_event.should_commit()) {