Skip to content

Commit

Permalink
Use anonymous name for FSWatch
Browse files Browse the repository at this point in the history
it's just very noisy for no reason otherwise tbh
  • Loading branch information
Tristan971 committed Jan 13, 2025
1 parent 0e2b3d5 commit 9fc5c4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScheduledFuture<?>> nextTick = new AtomicReference<>();

private final ThrowingFunction<String, Render> render;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/mangadex/mcw/source/file/FSWatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String> callback;
Expand All @@ -22,7 +24,7 @@ class FSWatch extends Thread {
FSWatch(FSSource source, Consumer<String> callback) {
this.source = source;
this.callback = callback;
setName(source.toString());
setName("watch-" + COUNTER.getAndIncrement());
setUncaughtExceptionHandler((_, e) -> LOGGER.error("Uncaught exception", e));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9fc5c4a

Please sign in to comment.