aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/java/TickedDataAggregator.java11
-rw-r--r--spark-minestom/build.gradle2
2 files changed, 7 insertions, 6 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/java/TickedDataAggregator.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/java/TickedDataAggregator.java
index d537b96..08cb719 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/java/TickedDataAggregator.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/java/TickedDataAggregator.java
@@ -30,6 +30,7 @@ import me.lucko.spark.proto.SparkSamplerProtos.SamplerMetadata;
import java.lang.management.ThreadInfo;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
@@ -75,7 +76,7 @@ public class TickedDataAggregator extends JavaDataAggregator {
public SamplerMetadata.DataAggregator getMetadata() {
// push the current tick (so numberOfTicks is accurate)
synchronized (this.mutex) {
- pushCurrentTick();
+ pushCurrentTick(Runnable::run);
this.currentData = null;
}
@@ -92,7 +93,7 @@ public class TickedDataAggregator extends JavaDataAggregator {
synchronized (this.mutex) {
int tick = this.tickHook.getCurrentTick();
if (this.currentTick != tick || this.currentData == null) {
- pushCurrentTick();
+ pushCurrentTick(this.workerPool);
this.currentTick = tick;
this.currentData = new TickList(this.expectedSize, window);
}
@@ -102,7 +103,7 @@ public class TickedDataAggregator extends JavaDataAggregator {
}
// guarded by 'mutex'
- private void pushCurrentTick() {
+ private void pushCurrentTick(Executor executor) {
TickList currentData = this.currentData;
if (currentData == null) {
return;
@@ -116,7 +117,7 @@ public class TickedDataAggregator extends JavaDataAggregator {
return;
}
- this.workerPool.submit(currentData);
+ executor.execute(currentData);
this.tickCounter.increment();
}
@@ -124,7 +125,7 @@ public class TickedDataAggregator extends JavaDataAggregator {
public List<ThreadNode> exportData() {
// push the current tick
synchronized (this.mutex) {
- pushCurrentTick();
+ pushCurrentTick(Runnable::run);
}
return super.exportData();
diff --git a/spark-minestom/build.gradle b/spark-minestom/build.gradle
index 627eda7..788201b 100644
--- a/spark-minestom/build.gradle
+++ b/spark-minestom/build.gradle
@@ -9,7 +9,7 @@ tasks.withType(JavaCompile) {
dependencies {
implementation project(':spark-common')
- compileOnly 'com.github.Minestom.Minestom:Minestom:067227421f'
+ compileOnly 'com.github.Minestom.Minestom:Minestom:master-SNAPSHOT'
implementation 'com.google.guava:guava:19.0'
}