diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index d281acdf006..c80c52e4ba3 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -987,6 +987,13 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) { guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); assert(owner_raw() != current, "invariant"); + // This thread has been notified so try to reacquire the lock. + if (TryLock(current) == TryLockResult::Success) { + break; + } + + // If that fails, spin again. Note that spin count may be zero so the above TryLock + // is necessary. if (TrySpin(current)) { break; }