3
0
Mirror von https://github.com/TheSilentPro/HeadDB.git synchronisiert 2024-12-26 02:50:07 +01:00
Dieser Commit ist enthalten in:
Silent 2023-11-29 23:27:50 +01:00
Ursprung e4691102ae
Commit 5ab69fa186
2 geänderte Dateien mit 8 neuen und 26 gelöschten Zeilen

Datei anzeigen

@ -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";

Datei anzeigen

@ -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());
}
}