diff options
author | lucko <git@lucko.me> | 2025-01-12 21:59:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-12 21:59:55 +0000 |
commit | 273f9bc8aa6501d7de908f12e26dc68657304704 (patch) | |
tree | 25abc4bea5da94746c4fea3b1999bd998ba5af7a /spark-common/src | |
parent | 336102f88b38900b60888ab85ea13b388d4fe0dc (diff) | |
download | spark-273f9bc8aa6501d7de908f12e26dc68657304704.tar.gz spark-273f9bc8aa6501d7de908f12e26dc68657304704.tar.bz2 spark-273f9bc8aa6501d7de908f12e26dc68657304704.zip |
Implement standalone profiling agent (#480)
Diffstat (limited to 'spark-common/src')
5 files changed, 9 insertions, 4 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index 0466e75..5e4e053 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -369,7 +369,7 @@ public class SparkPlatform { try { executeCommand0(sender, args); future.complete(null); - } catch (Exception e) { + } catch (Throwable e) { this.plugin.log(Level.SEVERE, "Exception occurred whilst executing a spark command", e); future.completeExceptionally(e); } finally { diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java index 1d71d53..96549a1 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformInfo.java @@ -48,7 +48,8 @@ public interface PlatformInfo { enum Type { SERVER(PlatformMetadata.Type.SERVER), CLIENT(PlatformMetadata.Type.CLIENT), - PROXY(PlatformMetadata.Type.PROXY); + PROXY(PlatformMetadata.Type.PROXY), + APPLICATION(PlatformMetadata.Type.APPLICATION); private final PlatformMetadata.Type type; diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java index 93bd59d..d9fbff2 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/PlatformStatisticsProvider.java @@ -219,7 +219,7 @@ public class PlatformStatisticsProvider { List<CommandSender> senders = this.platform.getPlugin().getCommandSenders().collect(Collectors.toList()); PlatformInfo.Type platformType = this.platform.getPlugin().getPlatformInfo().getType(); - if (platformType != PlatformInfo.Type.CLIENT) { + if (platformType == PlatformInfo.Type.SERVER || platformType == PlatformInfo.Type.PROXY) { long playerCount = senders.size() - 1; // includes console builder.setPlayerCount(playerCount); } diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/classfinder/InstrumentationClassFinder.java b/spark-common/src/main/java/me/lucko/spark/common/util/classfinder/InstrumentationClassFinder.java index 5f06d64..1381d4d 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/util/classfinder/InstrumentationClassFinder.java +++ b/spark-common/src/main/java/me/lucko/spark/common/util/classfinder/InstrumentationClassFinder.java @@ -57,7 +57,10 @@ public class InstrumentationClassFinder implements ClassFinder { private final Map<String, Class<?>> classes = new HashMap<>(); public InstrumentationClassFinder(SparkPlugin plugin) { - Instrumentation instrumentation = loadInstrumentation(plugin); + this(loadInstrumentation(plugin)); + } + + public InstrumentationClassFinder(Instrumentation instrumentation) { if (instrumentation == null) { return; } diff --git a/spark-common/src/main/proto/spark/spark.proto b/spark-common/src/main/proto/spark/spark.proto index f8d7988..4b95a4a 100644 --- a/spark-common/src/main/proto/spark/spark.proto +++ b/spark-common/src/main/proto/spark/spark.proto @@ -21,6 +21,7 @@ message PlatformMetadata { SERVER = 0; CLIENT = 1; PROXY = 2; + APPLICATION = 3; } } |