Package net.minecraft.util.thread
Class ThreadExecutor<R extends Runnable>
java.lang.Object
net.minecraft.util.thread.ThreadExecutor<R>
- All Implemented Interfaces:
AutoCloseable,Executor,MessageListener<R>
- Direct Known Subclasses:
ReentrantThreadExecutor,ServerChunkManager.MainThreadExecutor,SoundExecutor
public abstract class ThreadExecutor<R extends Runnable> extends Object implements MessageListener<R>, Executor
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedThreadExecutor(String name) -
Method Summary
Modifier and Type Method Description protected voidcancelTasks()protected abstract booleancanExecute(R task)protected abstract RcreateTask(Runnable runnable)voidexecute(Runnable runnable)protected voidexecuteTask(R task)StringgetName()intgetTaskCount()protected abstract ThreadgetThread()booleanisOnThread()protected booleanrunTask()protected voidrunTasks()voidrunTasks(BooleanSupplier stopCondition)voidsend(R r)protected booleanshouldExecuteAsync()CompletableFuture<Void>submit(Runnable task)<V> CompletableFuture<V>submit(Supplier<V> task)voidsubmitAndJoin(Runnable runnable)private CompletableFuture<Void>submitAsync(Runnable runnable)protected voidwaitForTasks()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.util.thread.MessageListener
ask, close, method_27918
-
Field Details
-
LOGGER
-
name
-
tasks
-
executionsInProgress
private int executionsInProgress
-
-
Constructor Details
-
ThreadExecutor
-
-
Method Details
-
createTask
-
canExecute
-
isOnThread
public boolean isOnThread() -
getThread
-
shouldExecuteAsync
protected boolean shouldExecuteAsync() -
getTaskCount
public int getTaskCount() -
getName
- Specified by:
getNamein interfaceMessageListener<R extends Runnable>
-
submit
-
submitAsync
-
submit
-
submitAndJoin
-
send
- Specified by:
sendin interfaceMessageListener<R extends Runnable>
-
execute
-
cancelTasks
@Environment(CLIENT) protected void cancelTasks() -
runTasks
protected void runTasks() -
runTask
protected boolean runTask() -
runTasks
-
waitForTasks
protected void waitForTasks() -
executeTask
-