/* * Decompiled with CFR 0.152. */ package net.minecraft.util.thread; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Consumer; import net.minecraft.util.profiling.metrics.MetricsRegistry; import net.minecraft.util.thread.AbstractConsecutiveExecutor; import net.minecraft.util.thread.StrictQueue; public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor { public PriorityConsecutiveExecutor(int priorityCount, Executor executor, String name) { super(new StrictQueue.FixedPriorityQueue(priorityCount), executor, name); MetricsRegistry.INSTANCE.add(this); } @Override public StrictQueue.RunnableWithPriority wrapRunnable(Runnable runnable) { return new StrictQueue.RunnableWithPriority(0, runnable); } public CompletableFuture scheduleWithResult(int priority, Consumer> futureConsumer) { CompletableFuture future = new CompletableFuture(); this.schedule(new StrictQueue.RunnableWithPriority(priority, () -> futureConsumer.accept(future))); return future; } }