diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java index 29b1dd6cb..8207fcc44 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java @@ -6,7 +6,6 @@ import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; -import com.google.common.cache.Cache; import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.exception.GeoIp2Exception; import com.maxmind.geoip2.model.CountryResponse; @@ -28,8 +27,6 @@ import java.util.zip.GZIPInputStream; * This class contains the geolocation cache. *
* It caches all IPs with their matching country. - *
- * This cache uses the Google Guava {@link Cache}.
*
* @author Fuzzlemann
* @since 3.5.5
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
index 00b1c0d59..21c8bf6aa 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
@@ -9,10 +9,7 @@ import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Verify;
import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
+import java.util.concurrent.*;
public class Processing implements SubSystem {
@@ -24,6 +21,7 @@ public class Processing implements SubSystem {
criticalExecutor = Executors.newFixedThreadPool(2);
saveInstance(nonCriticalExecutor);
saveInstance(criticalExecutor);
+ saveInstance(this);
}
public static void submit(Runnable runnable) {
@@ -40,27 +38,27 @@ public class Processing implements SubSystem {
public static void submitNonCritical(Runnable runnable) {
saveInstance(runnable);
- getInstance().nonCriticalExecutor.submit(runnable);
+ CompletableFuture.supplyAsync(() -> runnable, getInstance().nonCriticalExecutor)
+ .thenAccept(Runnable::run)
+ .handle(Processing::exceptionHandler);
}
public static void submitCritical(Runnable runnable) {
saveInstance(runnable);
- getInstance().criticalExecutor.submit(runnable);
+ CompletableFuture.supplyAsync(() -> runnable, getInstance().criticalExecutor)
+ .thenAccept(Runnable::run)
+ .handle(Processing::exceptionHandler);
}
public static void submitNonCritical(Runnable... runnables) {
- ExecutorService nonCriticalExecutor = getInstance().nonCriticalExecutor;
for (Runnable runnable : runnables) {
- saveInstance(runnable);
- nonCriticalExecutor.submit(runnable);
+ submitNonCritical(runnable);
}
}
public static void submitCritical(Runnable... runnables) {
- ExecutorService criticalExecutor = getInstance().criticalExecutor;
for (Runnable runnable : runnables) {
- saveInstance(runnable);
- criticalExecutor.submit(runnable);
+ submitCritical(runnable);
}
}
@@ -74,12 +72,35 @@ public class Processing implements SubSystem {
public static