hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
Print this page
rev 611 : Merge
@@ -162,24 +162,15 @@
if (o.equals(thread.threadObjectAddress())) {
return thread;
}
}
- long leastDiff = 0;
- boolean leastDiffInitialized = false;
- JavaThread theOwner = null;
for (JavaThread thread = first(); thread != null; thread = thread.next()) {
- Address addr = thread.highestLock();
- if (addr == null || addr.lessThan(o)) continue;
- long diff = addr.minus(o);
- if (!leastDiffInitialized || diff < leastDiff) {
- leastDiffInitialized = true;
- leastDiff = diff;
- theOwner = thread;
- }
+ if (thread.isLockOwned(o))
+ return thread;
}
- return theOwner;
+ return null;
}
public JavaThread owningThreadFromMonitor(ObjectMonitor monitor) {
return owningThreadFromMonitor(monitor.owner());
}