--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Fri Apr 03 15:59:19 2009 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Mon Apr 06 15:47:39 2009 -0700
@@ -164,20 +164,11 @@
}
}
- 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) {