From 9fc5c4aa424a7148f2db6d49ede8dce3a0634890 Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 13 Jan 2025 16:35:33 +0000 Subject: [PATCH] Use anonymous name for FSWatch it's just very noisy for no reason otherwise tbh --- .../mcw/lifecycle/scheduling/ScheduledRenderTask.java | 4 ++-- src/main/java/org/mangadex/mcw/source/file/FSWatch.java | 4 +++- src/main/resources/application.yml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/mangadex/mcw/lifecycle/scheduling/ScheduledRenderTask.java b/src/main/java/org/mangadex/mcw/lifecycle/scheduling/ScheduledRenderTask.java index 4818ee3..b2f0a23 100644 --- a/src/main/java/org/mangadex/mcw/lifecycle/scheduling/ScheduledRenderTask.java +++ b/src/main/java/org/mangadex/mcw/lifecycle/scheduling/ScheduledRenderTask.java @@ -18,9 +18,9 @@ public final class ScheduledRenderTask { private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledRenderTask.class); - private static final AtomicInteger SRTi = new AtomicInteger(); + private static final AtomicInteger COUNTER = new AtomicInteger(); - private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(t -> new Thread(t, "srt-" + SRTi.getAndIncrement())); + private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(t -> new Thread(t, "rendr-" + COUNTER.getAndIncrement())); private final AtomicReference> nextTick = new AtomicReference<>(); private final ThrowingFunction render; diff --git a/src/main/java/org/mangadex/mcw/source/file/FSWatch.java b/src/main/java/org/mangadex/mcw/source/file/FSWatch.java index 2062335..5e41ad1 100644 --- a/src/main/java/org/mangadex/mcw/source/file/FSWatch.java +++ b/src/main/java/org/mangadex/mcw/source/file/FSWatch.java @@ -4,6 +4,7 @@ import java.io.BufferedInputStream; import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import org.slf4j.Logger; @@ -13,6 +14,7 @@ class FSWatch extends Thread { private static final Logger LOGGER = LoggerFactory.getLogger(FSWatch.class); + private static final AtomicInteger COUNTER = new AtomicInteger(); private final FSSource source; private final Consumer callback; @@ -22,7 +24,7 @@ class FSWatch extends Thread { FSWatch(FSSource source, Consumer callback) { this.source = source; this.callback = callback; - setName(source.toString()); + setName("watch-" + COUNTER.getAndIncrement()); setUncaughtExceptionHandler((_, e) -> LOGGER.error("Uncaught exception", e)); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f64151c..acbbd09 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -44,7 +44,7 @@ logging: org.springframework.boot.web.embedded.jetty.JettyWebServer: info org.springframework.web.filter.CommonsRequestLoggingFilter: debug pattern: - console: "​time=%clr(%-24d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}){faint} level=%clr(%-5level) thr=%clr(%-6t){faint} src=%clr(%logger{0}){cyan} %m%n%wEx" + console: "​time=%clr(%-24d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}){faint} level=%clr(%-5level) thr=%clr(%-9t){faint} src=%clr(%logger{0}){cyan} %m%n%wEx" management: endpoint: