Class BlockableEventLoop<R extends Runnable>

java.lang.Object
net.minecraft.util.thread.BlockableEventLoop<R>
All Implemented Interfaces:
AutoCloseable, Executor, ProfilerMeasured, ProcessorHandle<R>
Direct Known Subclasses:
ReentrantBlockableEventLoop, ServerChunkCache.MainThreadExecutor, SoundEngineExecutor

public abstract class BlockableEventLoop<R extends Runnable> extends Object implements ProfilerMeasured, ProcessorHandle<R>, Executor
  • Field Details

    • name

      private final String name
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • pendingRunnables

      private final Queue<R extends Runnable> pendingRunnables
    • blockingCount

      private int blockingCount
  • Constructor Details

    • BlockableEventLoop

      protected BlockableEventLoop(String p_18686_)
  • Method Details

    • wrapRunnable

      protected abstract R wrapRunnable(Runnable p_18704_)
    • shouldRun

      protected abstract boolean shouldRun(R p_18703_)
    • isSameThread

      public boolean isSameThread()
    • getRunningThread

      protected abstract Thread getRunningThread()
    • scheduleExecutables

      protected boolean scheduleExecutables()
    • getPendingTasksCount

      public int getPendingTasksCount()
    • name

      public String name()
      Specified by:
      name in interface ProcessorHandle<R extends Runnable>
    • submit

      public <V> CompletableFuture<V> submit(Supplier<V> p_18692_)
    • submitAsync

      public CompletableFuture<Void> submitAsync(Runnable p_18690_)
    • submit

      public CompletableFuture<Void> submit(Runnable p_18708_)
    • executeBlocking

      public void executeBlocking(Runnable p_18710_)
    • tell

      public void tell(R p_18712_)
      Specified by:
      tell in interface ProcessorHandle<R extends Runnable>
    • execute

      public void execute(Runnable p_18706_)
      Specified by:
      execute in interface Executor
    • executeIfPossible

      public void executeIfPossible(Runnable p_201937_)
    • dropAllTasks

      protected void dropAllTasks()
    • runAllTasks

      protected void runAllTasks()
    • pollTask

      public boolean pollTask()
    • managedBlock

      public void managedBlock(BooleanSupplier p_18702_)
    • waitForTasks

      protected void waitForTasks()
    • doRunTask

      protected void doRunTask(R p_18700_)
    • profiledMetrics

      public List<MetricSampler> profiledMetrics()
      Specified by:
      profiledMetrics in interface ProfilerMeasured