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 Executor, TaskScheduler<R>, ProfilerMeasured
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longprivate intprivate static @Nullable Supplier<CrashReport> private static final org.slf4j.Loggerprivate final Stringprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBlockableEventLoop(String name, boolean propagatesCrashes) -
Method Summary
Modifier and TypeMethodDescriptionvoiddelayCrash(CrashReport crashReport) protected voidprotected voidvoidvoidexecuteBlocking(Runnable runnable) voidexecuteIfPossible(Runnable command) intprotected abstract Threadprotected booleanstatic booleanbooleanvoidmanagedBlock(BooleanSupplier condition) Drive the executor until the given BooleanSupplier returns truename()protected booleanpollTask()static voidrelayDelayCrash(CrashReport crashReport) protected voidvoidprotected booleanprotected abstract booleanprotected boolean<V> CompletableFuture<V> submitAsync(Runnable runnable) private voidprotected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TaskScheduler
close, scheduleWithResult, wrapRunnable
-
Field Details
-
BLOCK_TIME_NANOS
public static final long BLOCK_TIME_NANOS- See Also:
-
delayedCrash
-
propagatesCrashes
private final boolean propagatesCrashes -
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() -
shouldRunAllTasks
protected boolean shouldRunAllTasks() -
pollTask
protected boolean pollTask() -
managedBlock
Drive the executor until the given BooleanSupplier returns true -
waitForTasks
protected void waitForTasks() -
doRunTask
-
profiledMetrics
- Specified by:
profiledMetricsin interfaceProfilerMeasured
-
isNonRecoverable
-
throwDelayedException
private void throwDelayedException() -
hasDelayedCrash
protected boolean hasDelayedCrash() -
delayCrash
-
relayDelayCrash
-