Deprecate public Timings classes for removal (#8949)

This commit is contained in:
Nassim Jahnke 2023-03-28 04:58:46 +02:00
parent 06eb9f83ec
commit afa3115148
2 changed files with 27 additions and 1 deletions

View file

@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
+
+@Deprecated(forRemoval = true)
+public class FullServerTickHandler extends TimingHandler {
+ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null);
+ final TimingData minuteData;
@ -131,6 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@Deprecated(forRemoval = true)
+public final class NullTimingHandler implements Timing {
+ public static final Timing NULL = new NullTimingHandler();
+ @NotNull
@ -213,6 +215,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@Deprecated(forRemoval = true)
+public class TimedEventExecutor implements EventExecutor {
+
+ private final EventExecutor executor;
@ -296,7 +299,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+/**
+ * Provides an ability to time sections of code within the Minecraft Server
+ *
+ * @deprecated Timings will likely be replaced with Spark in the future
+ */
+@Deprecated(forRemoval = true)
+public interface Timing extends AutoCloseable {
+ /**
+ * Starts timing the execution until {@link #stopTiming()} is called.
@ -767,6 +773,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import static co.aikar.timings.TimingsManager.MINUTE_REPORTS;
+import static co.aikar.util.JSONUtil.*;
+
+@Deprecated(forRemoval = true)
+@SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"})
+public class TimingHistory {
+ public static long lastMinuteTime;
@ -1299,6 +1306,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @deprecated Timings will likely be replaced with Spark in the future
+ */
+@Deprecated(forRemoval = true)
+@SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"})
+public final class Timings {
+
@ -1556,6 +1567,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return TimingsManager.getHandler(groupName, name, groupHandler);
+ }
+}
+
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -1601,6 +1613,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import static net.kyori.adventure.text.Component.text;
+
+
+@Deprecated(forRemoval = true)
+public class TimingsCommand extends BukkitCommand {
+ private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste", "verbon", "verboff");
+ private long lastResetAttempt = 0;
@ -1729,6 +1742,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @deprecated Timings will likely be replaced with Spark in the future
+ */
+@Deprecated(forRemoval = true)
+public final class TimingsManager {
+ static final Map<TimingIdentifier, TimingHandler> TIMING_MAP = LoadingMap.of(
+ new ConcurrentHashMap<>(4096, .5F), TimingHandler::new
@ -1896,6 +1913,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import java.util.List;
+
+@Deprecated(forRemoval = true)
+@SuppressWarnings("WeakerAccess")
+public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender {
+ private final List<CommandSender> senders;
@ -2042,6 +2060,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@Deprecated(forRemoval = true)
+public class Counter <T> extends ForwardingMap<T, Long> {
+ private final Map<T, Long> counts = new HashMap<>();
+
@ -2096,6 +2115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Provides Utility methods that assist with generating JSON Objects
+ */
+@SuppressWarnings({"rawtypes", "SuppressionAnnotation"})
+@Deprecated(forRemoval = true)
+public final class JSONUtil {
+ private JSONUtil() {}
+
@ -2251,6 +2271,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param <V> Value
+ */
+@Deprecated(forRemoval = true)
+public class LoadingIntMap<V> extends Int2ObjectOpenHashMap<V> {
+ private final Function<Integer, V> loader;
+
@ -2357,6 +2378,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param <K> Key
+ * @param <V> Value
+ */
+@Deprecated(forRemoval = true)
+public class LoadingMap <K, V> extends AbstractMap<K, V> {
+ private final Map<K, V> backingMap;
+ private final java.util.function.Function<K, V> loader;
@ -2717,6 +2739,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param <K> Key Type of the Map
+ * @param <V> Value Type of the Map
+ */
+@Deprecated(forRemoval = true)
+public class MRUMapCache<K, V> extends AbstractMap<K, V> {
+ final Map<K, V> backingMap;
+ Object cacheKey;
@ -3604,7 +3627,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private long totalTime = 0;
- private long curTickTotal = 0;
- private long violations = 0;
+@Deprecated
+@Deprecated(forRemoval = true)
+public final class CustomTimingsHandler {
+ private final Timing handler;

View file

@ -26,6 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.Map;
+
+// TODO: Re-implement missing timers
+@Deprecated(forRemoval = true)
+public final class MinecraftTimings {
+
+ public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep");
@ -252,6 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import static net.kyori.adventure.text.Component.text;
+
+@SuppressWarnings({"rawtypes", "SuppressionAnnotation"})
+@Deprecated(forRemoval = true)
+public class TimingsExport extends Thread {
+
+ private final TimingsReportListener listeners;
@ -585,6 +587,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Set of timers per world, to track world specific timings.
+ */
+// TODO: Re-implement missing timers
+@Deprecated(forRemoval = true)
+public class WorldTimingsHandler {
+ public final Timing mobSpawn;
+ public final Timing doChunkUnload;