diff --git a/patches/server/0145-Base-thread-pool.patch b/patches/server/0145-Base-thread-pool.patch index d7bcf47..e0c93bd 100644 --- a/patches/server/0145-Base-thread-pool.patch +++ b/patches/server/0145-Base-thread-pool.patch @@ -3181,10 +3181,10 @@ index 0000000000000000000000000000000000000000..690979cb9b7ec3dedbd7d0c45d0c183a +} diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java new file mode 100644 -index 0000000000000000000000000000000000000000..f80c0e0ebeee46913ae050db77f888438064d8ae +index 0000000000000000000000000000000000000000..cc5373e78657d04a43cb844c4fcd5f0f9cacf187 --- /dev/null +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java -@@ -0,0 +1,110 @@ +@@ -0,0 +1,115 @@ +// Gale - base thread pool + +package org.galemc.gale.executor.queue; @@ -3250,7 +3250,12 @@ index 0000000000000000000000000000000000000000..f80c0e0ebeee46913ae050db77f88843 + * asynchronously with respect to the {@link ServerThread} and the ticking of the server. + * Execution of + */ -+ ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async", 6)); ++ ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async", 6)), ++ /** ++ * A tier for queues that contain tasks with the same considerations as {@link #ASYNC}, ++ * but with a low priority. ++ */ ++ LOW_PRIORITY_ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async.low", 3)); + + /** + * Equal to {@link #ordinal()}. @@ -3297,7 +3302,7 @@ index 0000000000000000000000000000000000000000..f80c0e0ebeee46913ae050db77f88843 +} diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java new file mode 100644 -index 0000000000000000000000000000000000000000..42cc10eb5c71879562b3dcc527730cb333a54100 +index 0000000000000000000000000000000000000000..cf8e2b42ecfc8205af5b105e19975c3e54ffec5f --- /dev/null +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java @@ -0,0 +1,92 @@ @@ -3357,7 +3362,7 @@ index 0000000000000000000000000000000000000000..42cc10eb5c71879562b3dcc527730cb3 + /** + * This queue explicitly stores tasks that represent steps or parts of steps in ticking the server and that must be + * executed on the main thread, and as such always have a higher priority in being started than pending tasks in -+ * {@link #anyTickScheduledServerThread} and {@link #scheduledAsync}. ++ * {@link #anyTickScheduledServerThread}. + *
+ * This queue may contain tasks of every {@link TaskSpan}. + *
diff --git a/patches/server/0146-Run-async-executor-tasks-on-base-thread-pool.patch b/patches/server/0146-Run-async-executor-tasks-on-base-thread-pool.patch index 5e29fcc..c4ed8a5 100644 --- a/patches/server/0146-Run-async-executor-tasks-on-base-thread-pool.patch +++ b/patches/server/0146-Run-async-executor-tasks-on-base-thread-pool.patch @@ -54,24 +54,33 @@ index ac12cabaf15bc3520ff74d09faa48a135c63f23c..0019e5eefc4b638526a75dd3706a5403 LOGGER.info("Closing Server"); try { diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java -index f80c0e0ebeee46913ae050db77f888438064d8ae..07212e5d1d9e0e30dc2475fc6e7777aa4d5ce66a 100644 +index cc5373e78657d04a43cb844c4fcd5f0f9cacf187..43cb69a7fc55f6b5db05158b5dba3637a664bd19 100644 --- a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java @@ -63,7 +63,9 @@ public enum BaseTaskQueueTier { * asynchronously with respect to the {@link ServerThread} and the ticking of the server. * Execution of */ -- ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async", 6)); +- ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async", 6)), + ASYNC(new AbstractTaskQueue[]{ + BaseTaskQueues.scheduledAsync -+ }, Integer.getInteger("gale.thread.priority.async", 6)); - ++ }, Integer.getInteger("gale.thread.priority.async", 6)), /** - * Equal to {@link #ordinal()}. + * A tier for queues that contain tasks with the same considerations as {@link #ASYNC}, + * but with a low priority. diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java -index 42cc10eb5c71879562b3dcc527730cb333a54100..2295ead9ddcb57be81f8b8bd0731f56c9f7f60b9 100644 +index cf8e2b42ecfc8205af5b105e19975c3e54ffec5f..2295ead9ddcb57be81f8b8bd0731f56c9f7f60b9 100644 --- a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java +@@ -54,7 +54,7 @@ public final class BaseTaskQueues { + /** + * This queue explicitly stores tasks that represent steps or parts of steps in ticking the server and that must be + * executed on the main thread, and as such always have a higher priority in being started than pending tasks in +- * {@link #anyTickScheduledServerThread}. ++ * {@link #anyTickScheduledServerThread} and {@link #scheduledAsync}. + *
+ * This queue may contain tasks of every {@link TaskSpan}. + *
@@ -79,7 +79,8 @@ public final class BaseTaskQueues { /** diff --git a/patches/server/0151-Run-cleaner-tasks-on-base-thread-pool.patch b/patches/server/0151-Run-cleaner-tasks-on-base-thread-pool.patch index ad9dc0a..fabeea0 100644 --- a/patches/server/0151-Run-cleaner-tasks-on-base-thread-pool.patch +++ b/patches/server/0151-Run-cleaner-tasks-on-base-thread-pool.patch @@ -77,7 +77,7 @@ index 80f9e70d5c4330e079feccc9a4b1b5957c79ef45..e4955e8d04735b74007aae0bf3230281 public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE); diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java -index 07212e5d1d9e0e30dc2475fc6e7777aa4d5ce66a..648621821d1ac3a0f5aa2af57c8c7d9176c3cfdf 100644 +index 43cb69a7fc55f6b5db05158b5dba3637a664bd19..c5e05b115eb3f8b2d55c5aa2ffce8d86822becf2 100644 --- a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java @@ -64,6 +64,8 @@ public enum BaseTaskQueueTier { @@ -87,8 +87,8 @@ index 07212e5d1d9e0e30dc2475fc6e7777aa4d5ce66a..648621821d1ac3a0f5aa2af57c8c7d91 + // The cleaner queue has high priority because it releases resources back to a pool, thereby saving memory + BaseTaskQueues.cleaner, BaseTaskQueues.scheduledAsync - }, Integer.getInteger("gale.thread.priority.async", 6)); - + }, Integer.getInteger("gale.thread.priority.async", 6)), + /** diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java index 2295ead9ddcb57be81f8b8bd0731f56c9f7f60b9..92721a51268becb05d708db04e9d6daaa66fb8b2 100644 --- a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueues.java diff --git a/patches/server/0155-Run-chunk-worker-tasks-on-base-thread-pool.patch b/patches/server/0155-Run-chunk-worker-tasks-on-base-thread-pool.patch index 8529707..94cf448 100644 --- a/patches/server/0155-Run-chunk-worker-tasks-on-base-thread-pool.patch +++ b/patches/server/0155-Run-chunk-worker-tasks-on-base-thread-pool.patch @@ -533,10 +533,10 @@ index 0019e5eefc4b638526a75dd3706a54033dd9b811..7ed820d2483bf6741a355b062f062a04 this.isSaving = false; diff --git a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java -index bfcec658cbf381cc793d7dd844a81fac27c43337..dc006d9940ef8114a3a3e4860fbc1da0f7c2ee60 100644 +index 9a908566ccdda9ca77e0f9236f674f17f79e9c40..dc006d9940ef8114a3a3e4860fbc1da0f7c2ee60 100644 --- a/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java +++ b/src/main/java/org/galemc/gale/executor/queue/BaseTaskQueueTier.java -@@ -63,13 +63,19 @@ public enum BaseTaskQueueTier { +@@ -63,7 +63,6 @@ public enum BaseTaskQueueTier { /** * A tier for queues that contain general tasks that must be performed at some point in time, * asynchronously with respect to the {@link ServerThread} and the ticking of the server. @@ -544,14 +544,11 @@ index bfcec658cbf381cc793d7dd844a81fac27c43337..dc006d9940ef8114a3a3e4860fbc1da0 */ ASYNC(new AbstractTaskQueue[]{ // The cleaner queue has high priority because it releases resources back to a pool, thereby saving memory - BaseTaskQueues.cleaner, - BaseTaskQueues.scheduledAsync -- }, Integer.getInteger("gale.thread.priority.async", 6)); -+ }, Integer.getInteger("gale.thread.priority.async", 6)), -+ /** -+ * A tier for queues that contain tasks with the same considerations as {@link #ASYNC}, -+ * but with a low priority. -+ */ +@@ -74,7 +73,9 @@ public enum BaseTaskQueueTier { + * A tier for queues that contain tasks with the same considerations as {@link #ASYNC}, + * but with a low priority. + */ +- LOW_PRIORITY_ASYNC(new AbstractTaskQueue[0], Integer.getInteger("gale.thread.priority.async.low", 3)); + LOW_PRIORITY_ASYNC(new AbstractTaskQueue[]{ + BaseTaskQueues.chunkWorker + }, Integer.getInteger("gale.thread.priority.async.low", 3));