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
,ProcessorHandle<R>
- Direct Known Subclasses:
ReentrantBlockableEventLoop
,ServerChunkCache.MainThreadExecutor
,SoundEngineExecutor
public abstract class BlockableEventLoop<R extends Runnable>
extends Object
implements ProfilerMeasured, ProcessorHandle<R>, Executor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final org.slf4j.Logger
private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
void
void
executeBlocking
(Runnable pTask) void
executeIfPossible
(Runnable pTask) int
protected abstract Thread
boolean
void
managedBlock
(BooleanSupplier pIsDone) Drive the executor until the given BooleanSupplier returns truename()
boolean
pollTask()
protected void
protected boolean
protected abstract boolean
<V> CompletableFuture
<V> submitAsync
(Runnable pTask) void
void
protected abstract R
wrapRunnable
(Runnable pRunnable) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.util.thread.ProcessorHandle
ask, askEither, close
-
Field Details
-
name
-
LOGGER
private static final org.slf4j.Logger LOGGER -
pendingRunnables
-
blockingCount
private int blockingCount
-
-
Constructor Details
-
BlockableEventLoop
-
-
Method Details
-
wrapRunnable
-
shouldRun
-
isSameThread
public boolean isSameThread() -
getRunningThread
-
scheduleExecutables
protected boolean scheduleExecutables() -
getPendingTasksCount
public int getPendingTasksCount() -
name
- Specified by:
name
in interfaceProcessorHandle<R extends Runnable>
-
submit
-
submitAsync
-
submit
-
executeBlocking
-
tell
- Specified by:
tell
in interfaceProcessorHandle<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
public void waitForTasks() -
doRunTask
-
profiledMetrics
- Specified by:
profiledMetrics
in interfaceProfilerMeasured
-