--- a/hotspot/src/share/vm/runtime/thread.cpp Fri May 19 06:50:58 2017 +0000
+++ b/hotspot/src/share/vm/runtime/thread.cpp Fri May 19 12:14:38 2017 +0200
@@ -336,9 +336,6 @@
Thread::~Thread() {
- // Reclaim the objectmonitors from the omFreeList of the moribund thread.
- ObjectSynchronizer::omFlush(this);
-
EVENT_THREAD_DESTRUCT(this);
// stack_base can be NULL if the thread is never started or exited before
@@ -4251,6 +4248,10 @@
}
void Threads::remove(JavaThread* p) {
+
+ // Reclaim the objectmonitors from the omInUseList and omFreeList of the moribund thread.
+ ObjectSynchronizer::omFlush(p);
+
// Extra scope needed for Thread_lock, so we can check
// that we do not remove thread without safepoint code notice
{ MutexLocker ml(Threads_lock);