changeset 50065:ae0ebd3cf949

8202564: java/lang/management/ThreadMXBean/ThreadCounts.java fails Summary: _exiting_daemon_threads_count needs to be decremented at the right place Reviewed-by: kvn, dcubed
author mdoerr
date Tue, 08 May 2018 15:40:03 +0200
parents e4a7bacf99b1
children bd3e4517dfa3
files src/hotspot/share/services/threadService.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/services/threadService.cpp	Wed May 09 09:50:25 2018 +0800
+++ b/src/hotspot/share/services/threadService.cpp	Tue May 08 15:40:03 2018 +0200
@@ -122,6 +122,9 @@
 
 void ThreadService::remove_thread(JavaThread* thread, bool daemon) {
   Atomic::dec(&_exiting_threads_count);
+  if (daemon) {
+    Atomic::dec(&_exiting_daemon_threads_count);
+  }
 
   if (thread->is_hidden_from_external_view() ||
       thread->is_jvmti_agent_thread()) {
@@ -129,10 +132,8 @@
   }
 
   _live_threads_count->set_value(_live_threads_count->get_value() - 1);
-
   if (daemon) {
     _daemon_threads_count->set_value(_daemon_threads_count->get_value() - 1);
-    Atomic::dec(&_exiting_daemon_threads_count);
   }
 }