diff --git a/src/main/java/tsp/headdb/Metrics.java b/src/main/java/tsp/headdb/Metrics.java index 9733d08..2dd9e47 100644 --- a/src/main/java/tsp/headdb/Metrics.java +++ b/src/main/java/tsp/headdb/Metrics.java @@ -5,7 +5,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import tsp.headdb.core.storage.HeadDBThreadFactory; +import org.jetbrains.annotations.NotNull; import javax.net.ssl.HttpsURLConnection; import java.io.*; @@ -13,10 +13,7 @@ import java.lang.reflect.Method; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; @@ -133,7 +130,12 @@ class Metrics { /** The version of the Metrics class. */ public static final String METRICS_VERSION = "3.0.0"; - private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(HeadDBThreadFactory.FACTORY); + private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override + public Thread newThread(@NotNull Runnable r) { + return new Thread("headdb-metrics"); + } + }); private static final String REPORT_URL = "https://bStats.org/api/v2/data/%s"; diff --git a/src/main/java/tsp/headdb/core/storage/HeadDBThreadFactory.java b/src/main/java/tsp/headdb/core/storage/HeadDBThreadFactory.java deleted file mode 100644 index 1fe7fa7..0000000 --- a/src/main/java/tsp/headdb/core/storage/HeadDBThreadFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package tsp.headdb.core.storage; - -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; - -public final class HeadDBThreadFactory implements ThreadFactory { - - private HeadDBThreadFactory() {} - - public static final HeadDBThreadFactory FACTORY = new HeadDBThreadFactory(); - private final AtomicInteger ID = new AtomicInteger(1); - - @Override - public Thread newThread(@NotNull Runnable r) { - return new Thread(r, "headdb-thread-" + ID.getAndIncrement()); - } - -}