From 78443798800c1fd5614b40f98c3c7071ec65656e Mon Sep 17 00:00:00 2001 From: Peter Shipton Date: Wed, 9 Aug 2023 17:11:57 -0400 Subject: [PATCH] Set a default thread name for java.util.TimerThread Issue https://github.com/eclipse-openj9/openj9/issues/11930 The name isn't set in the TimerThread constructor, it calls Thread.newName() which consumes the "Thread-0" name. This causes the test to fail because it expects this name. This could have an impact on / confuse users which expect consistent thread names. Depending on the timing of the Attach API AttachHandler / FilelockTimer creation, an application can get different default thread names from run to run. Backport of https://github.com/ibmruntimes/openj9-openjdk-jdk/pull/640 Signed-off-by: Peter Shipton --- src/java.base/share/classes/java/util/Timer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/util/Timer.java b/src/java.base/share/classes/java/util/Timer.java index bbdd758022b..f29e1955bfc 100644 --- a/src/java.base/share/classes/java/util/Timer.java +++ b/src/java.base/share/classes/java/util/Timer.java @@ -25,7 +25,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -542,6 +542,7 @@ class TimerThread extends Thread { private TaskQueue queue; TimerThread(TaskQueue queue) { + super("java.util.TimerThread"); this.queue = queue; }