aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java/me/shedaniel/rei/impl/common
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-11-07 16:21:34 +0800
committershedaniel <daniel@shedaniel.me>2021-11-07 16:21:34 +0800
commitf8fc41207ca444c0a90ae10d78a821831b245bc2 (patch)
treea2a049cc4ead3157eb9d284027e12798f9e48c81 /runtime/src/main/java/me/shedaniel/rei/impl/common
parentd1e91e2e2ffa317a52e659f2ca2b76800108f427 (diff)
downloadRoughlyEnoughItems-f8fc41207ca444c0a90ae10d78a821831b245bc2.tar.gz
RoughlyEnoughItems-f8fc41207ca444c0a90ae10d78a821831b245bc2.tar.bz2
RoughlyEnoughItems-f8fc41207ca444c0a90ae10d78a821831b245bc2.zip
Fix #654
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/impl/common')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/performance/PerformanceLoggerImpl.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java4
2 files changed, 8 insertions, 2 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/performance/PerformanceLoggerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/performance/PerformanceLoggerImpl.java
index 934bf494e..227d067c7 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/performance/PerformanceLoggerImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/performance/PerformanceLoggerImpl.java
@@ -28,14 +28,16 @@ import com.google.common.collect.Maps;
import com.mojang.datafixers.util.Pair;
import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap;
+import it.unimi.dsi.fastutil.objects.Object2LongMaps;
import me.shedaniel.rei.api.common.plugins.REIPlugin;
import me.shedaniel.rei.api.common.plugins.REIPluginProvider;
+import java.util.Collections;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class PerformanceLoggerImpl implements PerformanceLogger {
- private final Map<String, PluginImpl> stages = Maps.newLinkedHashMap();
+ private final Map<String, PluginImpl> stages = Collections.synchronizedMap(Maps.newLinkedHashMap());
@Override
public Plugin stage(String stage) {
@@ -52,7 +54,7 @@ public class PerformanceLoggerImpl implements PerformanceLogger {
private static class PluginImpl implements Plugin {
private final Stopwatch stopwatch = Stopwatch.createUnstarted();
private long totalTime = 0;
- private Object2LongMap<Object> times = new Object2LongLinkedOpenHashMap<>();
+ private Object2LongMap<Object> times = Object2LongMaps.synchronize(new Object2LongLinkedOpenHashMap<>());
@Override
public Inner stage(String stage) {
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java
index 71b1cb716..bda591fb1 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java
@@ -213,6 +213,8 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager<
((REIPlugin<P>) plugin.plugin).preStage(this, stage);
}
});
+ } catch (Throwable throwable) {
+ new RuntimeException("Failed to run pre registration").printStackTrace();
}
}
@@ -229,6 +231,8 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager<
((REIPlugin<P>) plugin.plugin).postStage(this, stage);
}
});
+ } catch (Throwable throwable) {
+ new RuntimeException("Failed to run post registration").printStackTrace();
}
}