attempt to allow timings to continue with janky plugin classes

This commit is contained in:
Shane Freeder 2019-12-15 22:39:25 +00:00
parent 4d2f85630a
commit 1c38436266
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -1,4 +1,4 @@
From 4c63953c6c9a33d2b257fc8fcd781e6291181aba Mon Sep 17 00:00:00 2001
From 4940966a47053eee781a2859090f7b1d6f381b42 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -6,10 +6,10 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
index 000000000..c6818bc86
index 000000000..69e26a826
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,135 @@
@@ -0,0 +1,141 @@
+package co.aikar.timings;
+
+import com.google.common.collect.MapMaker;
@ -79,10 +79,16 @@ index 000000000..c6818bc86
+ plugin = TimingsManager.getPluginByClassloader(taskClass);
+ }
+
+ final String taskname = taskNameCache.computeIfAbsent(taskClass, clazz ->
+ clazz.isAnonymousClass() || clazz.isLocalClass()
+ ? clazz.getName()
+ : clazz.getCanonicalName());
+ final String taskname = taskNameCache.computeIfAbsent(taskClass, clazz -> {
+ try {
+ return clazz.isAnonymousClass() || clazz.isLocalClass()
+ ? clazz.getName()
+ : clazz.getCanonicalName();
+ } catch (Throwable ex) {
+ new Exception("Error occurred detecting class name", ex).printStackTrace();
+ return "MangledClassFile";
+ }
+ });
+
+ StringBuilder name = new StringBuilder(64);
+ name.append("Task: ").append(taskname);
@ -1837,5 +1843,5 @@ index ca7789b5e..442383969 100644
}
}
--
2.24.0
2.24.1