mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Allow onion bursting for post mantle jobs
This commit is contained in:
parent
b71a87e803
commit
851053fd9a
@ -44,6 +44,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ -189,8 +190,13 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
}
|
||||
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
List<Runnable> post = Collections.synchronizedList(new KList<>());
|
||||
Consumer<Runnable> c = post::add;
|
||||
KList<Runnable> post = new KList<>();
|
||||
Consumer<Runnable> c = (i) -> {
|
||||
synchronized (post)
|
||||
{
|
||||
post.add(i);
|
||||
}
|
||||
};
|
||||
int s = getRealRadius();
|
||||
BurstExecutor burst = burst().burst();
|
||||
|
||||
@ -205,7 +211,13 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
}
|
||||
|
||||
burst.complete();
|
||||
burst().burst(post);
|
||||
|
||||
while(!post.isEmpty())
|
||||
{
|
||||
KList<Runnable> px = post.copy();
|
||||
post.clear();
|
||||
burst().burst(px);
|
||||
}
|
||||
}
|
||||
|
||||
default void generateMantleComponent(int x, int z, MantleComponent c, Consumer<Runnable> post) {
|
||||
|
@ -45,7 +45,7 @@ public class BurstExecutor {
|
||||
|
||||
public BurstExecutor queue(List<Runnable> r) {
|
||||
synchronized (futures) {
|
||||
for (Runnable i : r) {
|
||||
for (Runnable i : new KList<>(r)) {
|
||||
CompletableFuture<Void> c = CompletableFuture.runAsync(i, executor);
|
||||
futures.add(c);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user