--- a/hotspot/src/share/vm/runtime/java.cpp Thu May 29 14:31:28 2014 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp Wed Jun 04 14:16:20 2014 +0200
@@ -501,6 +501,9 @@
os::infinite_sleep();
}
+ // Stop any ongoing concurrent GC work
+ Universe::heap()->stop();
+
// Terminate watcher thread - must before disenrolling any periodic task
if (PeriodicTask::num_tasks() > 0)
WatcherThread::stop();
@@ -515,8 +518,10 @@
StatSampler::disengage();
StatSampler::destroy();
- // Stop concurrent GC threads
- Universe::heap()->stop();
+ // We do not need to explicitly stop concurrent GC threads because the
+ // JVM will be taken down at a safepoint when such threads are inactive --
+ // except for some concurrent G1 threads, see (comment in)
+ // Threads::destroy_vm().
// Print GC/heap related information.
if (PrintGCDetails) {