Package net.minecraft.util.concurrent
Class ThreadTaskExecutor<R extends java.lang.Runnable>
- java.lang.Object
-
- net.minecraft.util.concurrent.ThreadTaskExecutor<R>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.util.concurrent.Executor
,ITaskExecutor<R>
- Direct Known Subclasses:
RecursiveEventLoop
,ServerChunkProvider.ChunkExecutor
,SoundEngineExecutor
public abstract class ThreadTaskExecutor<R extends java.lang.Runnable> extends java.lang.Object implements ITaskExecutor<R>, java.util.concurrent.Executor
-
-
Field Summary
Fields Modifier and Type Field Description private int
blockingCount
private static org.apache.logging.log4j.Logger
LOGGER
private java.lang.String
name
private java.util.Queue<R>
pendingRunnables
-
Constructor Summary
Constructors Modifier Constructor Description protected
ThreadTaskExecutor(java.lang.String p_i50403_1_)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
doRunTask(R p_213166_1_)
protected void
dropAllTasks()
void
execute(java.lang.Runnable p_execute_1_)
void
executeBlocking(java.lang.Runnable p_213167_1_)
int
getPendingTasksCount()
protected abstract java.lang.Thread
getRunningThread()
boolean
isSameThread()
void
managedBlock(java.util.function.BooleanSupplier p_213161_1_)
java.lang.String
name()
protected boolean
pollTask()
protected void
runAllTasks()
protected boolean
scheduleExecutables()
protected abstract boolean
shouldRun(R p_212874_1_)
java.util.concurrent.CompletableFuture<java.lang.Void>
submit(java.lang.Runnable p_222817_1_)
<V> java.util.concurrent.CompletableFuture<V>
submit(java.util.function.Supplier<V> p_213169_1_)
java.util.concurrent.CompletableFuture<java.lang.Void>
submitAsync(java.lang.Runnable p_213165_1_)
void
tell(R p_212871_1_)
protected void
waitForTasks()
protected abstract R
wrapRunnable(java.lang.Runnable p_212875_1_)
-
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.concurrent.ITaskExecutor
ask, askEither, close
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
pendingRunnables
private final java.util.Queue<R extends java.lang.Runnable> pendingRunnables
-
blockingCount
private int blockingCount
-
-
Method Detail
-
wrapRunnable
protected abstract R wrapRunnable(java.lang.Runnable p_212875_1_)
-
shouldRun
protected abstract boolean shouldRun(R p_212874_1_)
-
isSameThread
public boolean isSameThread()
-
getRunningThread
protected abstract java.lang.Thread getRunningThread()
-
scheduleExecutables
protected boolean scheduleExecutables()
-
getPendingTasksCount
public int getPendingTasksCount()
-
name
public java.lang.String name()
- Specified by:
name
in interfaceITaskExecutor<R extends java.lang.Runnable>
-
submit
public <V> java.util.concurrent.CompletableFuture<V> submit(java.util.function.Supplier<V> p_213169_1_)
-
submitAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> submitAsync(java.lang.Runnable p_213165_1_)
-
submit
public java.util.concurrent.CompletableFuture<java.lang.Void> submit(java.lang.Runnable p_222817_1_)
-
executeBlocking
public void executeBlocking(java.lang.Runnable p_213167_1_)
-
tell
public void tell(R p_212871_1_)
- Specified by:
tell
in interfaceITaskExecutor<R extends java.lang.Runnable>
-
execute
public void execute(java.lang.Runnable p_execute_1_)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
-
dropAllTasks
protected void dropAllTasks()
-
runAllTasks
protected void runAllTasks()
-
pollTask
protected boolean pollTask()
-
managedBlock
public void managedBlock(java.util.function.BooleanSupplier p_213161_1_)
-
waitForTasks
protected void waitForTasks()
-
doRunTask
protected void doRunTask(R p_213166_1_)
-
-