< prev index next >

src/hotspot/share/services/threadService.cpp

Print this page
@@ -453,14 +453,12 @@
          if (owner != NULL && // the raw monitor could be released at any time
              owner->is_Java_thread()) {
            currentThread = JavaThread::cast(owner);
          }
        } else if (waitingToLockMonitor != NULL) {
-         address currentOwner = (address)waitingToLockMonitor->owner();
-         if (currentOwner != NULL) {
-           currentThread = Threads::owning_thread_from_monitor_owner(t_list,
-                                                                     currentOwner);
+         if (waitingToLockMonitor->is_owner_anonymous() || waitingToLockMonitor->owner() != NULL) {
+           currentThread = Threads::owning_thread_from_monitor(t_list, waitingToLockMonitor);
            if (currentThread == NULL) {
              // This function is called at a safepoint so the JavaThread
              // that owns waitingToLockMonitor should be findable, but
              // if it is not findable, then the previous currentThread is
              // blocked permanently. We record this as a deadlock.

@@ -1050,12 +1048,11 @@
                   obj->klass()->external_name());
  
        if (!currentThread->current_pending_monitor_is_from_java()) {
          owner_desc = "\n  in JNI, which is held by";
        }
-       currentThread = Threads::owning_thread_from_monitor_owner(t_list,
-                                                                 (address)waitingToLockMonitor->owner());
+       currentThread = Threads::owning_thread_from_monitor(t_list, waitingToLockMonitor);
        if (currentThread == NULL) {
          // The deadlock was detected at a safepoint so the JavaThread
          // that owns waitingToLockMonitor should be findable, but
          // if it is not findable, then the previous currentThread is
          // blocked permanently.
< prev index next >