Package net.minecraft.util.thread
Class BlockableEventLoop<R extends Runnable>
java.lang.Object
net.minecraft.util.thread.BlockableEventLoop<R>
- All Implemented Interfaces:
AutoCloseable,Executor,ProfilerMeasured,TaskScheduler<R>
- Direct Known Subclasses:
ReentrantBlockableEventLoop,ServerChunkCache.MainThreadExecutor,SoundEngineExecutor
public abstract class BlockableEventLoop<R extends Runnable>
extends Object
implements ProfilerMeasured, TaskScheduler<R>, Executor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longprivate intprivate static final org.slf4j.Loggerprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidvoidvoidexecuteBlocking(Runnable pTask) voidexecuteIfPossible(Runnable pTask) intprotected abstract Threadstatic booleanisNonRecoverable(Throwable pError) booleanvoidmanagedBlock(BooleanSupplier pIsDone) Drive the executor until the given BooleanSupplier returns truename()booleanpollTask()protected voidvoidprotected booleanprotected abstract boolean<V> CompletableFuture<V> submitAsync(Runnable pTask) protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.util.thread.TaskScheduler
close, scheduleWithResult, wrapRunnable
-
Field Details
-
BLOCK_TIME_NANOS
public static final long BLOCK_TIME_NANOS- See Also:
-
name
-
LOGGER
private static final org.slf4j.Logger LOGGER -
pendingRunnables
-
blockingCount
private int blockingCount
-
-
Constructor Details
-
BlockableEventLoop
-
-
Method Details
-
shouldRun
-
isSameThread
public boolean isSameThread() -
getRunningThread
-
scheduleExecutables
protected boolean scheduleExecutables() -
getPendingTasksCount
public int getPendingTasksCount() -
name
- Specified by:
namein interfaceTaskScheduler<R extends Runnable>
-
submit
-
submitAsync
-
submit
-
executeBlocking
-
schedule
- Specified by:
schedulein interfaceTaskScheduler<R extends Runnable>
-
execute
-
executeIfPossible
-
dropAllTasks
protected void dropAllTasks() -
runAllTasks
protected void runAllTasks() -
pollTask
public boolean pollTask() -
managedBlock
Drive the executor until the given BooleanSupplier returns true -
waitForTasks
protected void waitForTasks() -
doRunTask
-
profiledMetrics
- Specified by:
profiledMetricsin interfaceProfilerMeasured
-
isNonRecoverable
-