8205540: test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001.java fails with Debuggee did not exit after 15 <cont> commands
Summary: screen usage/initialization of TerminatingThreadLocal with a non-null check on Thread.threadLocals field
Reviewed-by: dholmes, alanb
--- a/src/java.base/share/classes/java/lang/Thread.java Sat Jun 23 22:49:48 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Thread.java Sun Jun 24 10:41:51 2018 +0200
@@ -840,7 +840,7 @@
* 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) {