生成されたスレッドのメイン処理が終わると, JavaThread::exit() による終了処理が実行される.
-> JavaThread::exit()
-> (1) Threads::destroy_vm() から呼ばれたものではない場合 (もしくは JDK バージョンが 1.2 の場合) には, 以下の処理を行う.
-> (1) 例外があれば, uncaughtException を呼び出す.
-> JavaCalls::call_virtual()
-> (See: here for details)
-> java.lang.Thread.dispatchUncaughtException() or
java.lang.ThreadGroup.uncaughtException()
-> (1) java.lang.Thread.exit() メソッドを呼び出す.
-> JavaCalls::call_virtual()
-> (See: here for details)
-> java.lang.Thread.exit()
-> (1) 他の スレッドから suspend されている場合は, それが解けるまで待つ
-> JavaThread::is_external_suspend()
-> JavaThread::java_suspend_self()
-> ThreadService::current_thread_exiting()
(1) このスレッドに対して java.lang.Thread.join() で待っているスレッドに終了を通知する.
-> ensure_join()
-> ObjectLocker::notify_all()
-> ObjectSynchronizer::notifyall() (See: here for details)
(1) JNI の DetachCurrentThread() から呼ばれたものである場合は, ロック開放処理を行う.
-> ObjectSynchronizer::release_monitors_owned_by_thread()
-> ObjectSynchronizer::monitors_iterate()
-> ReleaseJavaMonitorsClosure::do_monitor()
-> ObjectMonitor::complete_exit()
(1) JNI ローカル参照フレームを破棄する
-> JNIHandleBlock::release_block() (← active_handles を解放)
(1) JNIHandleBlock の thread local なフリーリストを破棄する
-> JNIHandleBlock::release_block() (← free_handle_block を解放)
(1) カレントスレッドのスタック上の guard page を解除する
-> JavaThread::remove_stack_guard_pages()
(1) TLAB の残りの領域を無効化しておく
-> ThreadLocalAllocBuffer::make_parsable()
(1) JvmtiThreadState のメモリを開放しておく.
-> JvmtiExport::cleanup_thread()
(1) G1GC 使用時には, 使用していたキュー (ObjPtrQueue, DirtyCardQueue) に溜まっている内容をフラッシュしておく
-> flush_barrier_queues()
(1) スレッドの一覧リスト(Threads::_thread_list)からカレントスレッドを外す
-> Threads::remove()
See: here for details
See: here for details
(#Under Construction)
See: here for details
See: here for details
(#Under Construction)
(#Under Construction)
See: here for details
See: here for details (#Under Construction)
(#Under Construction)
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.