8205540: test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001.java fails with Debuggee did not exit after 15 <cont> commands

Screen usage/initialization of TerminatingThreadLocal with a non-null check on Thread.threadLocals field

Reviewed-by: dholmes, alanb
This commit is contained in:
Peter Levart 2018-06-24 10:41:51 +02:00
parent e9fc42d791
commit a9912bb300

View File

@ -840,7 +840,7 @@ class Thread implements Runnable {
* a chance to clean up before it actually exits.
*/
private void exit() {
if (TerminatingThreadLocal.REGISTRY.isPresent()) {
if (threadLocals != null && TerminatingThreadLocal.REGISTRY.isPresent()) {
TerminatingThreadLocal.threadTerminated();
}
if (group != null) {