Skip to content

Commit 5f60ea5

Browse files
jgneffkevinrushforth
authored andcommitted
8248381: Create a daemon thread for MonocleTimer
Reviewed-by: kcr, jvos
1 parent 2f4666a commit 5f60ea5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/MonocleTimer.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* Monocle implementation class for Timer.
3535
*/
3636
final class MonocleTimer extends Timer {
37+
private static final String THREAD_NAME = "Monocle Timer";
38+
3739
private static ScheduledThreadPoolExecutor scheduler;
3840
private ScheduledFuture<?> task;
3941

@@ -51,7 +53,11 @@ static int getMaxPeriod_impl() {
5153

5254
@Override protected long _start(final Runnable runnable, int period) {
5355
if (scheduler == null) {
54-
scheduler = new ScheduledThreadPoolExecutor(1);
56+
scheduler = new ScheduledThreadPoolExecutor(1, target -> {
57+
Thread thread = new Thread(target, THREAD_NAME);
58+
thread.setDaemon(true);
59+
return thread;
60+
});
5561
}
5662

5763
task = scheduler.scheduleAtFixedRate(runnable, 0, period, TimeUnit.MILLISECONDS);

0 commit comments

Comments
 (0)