public abstract class ThreadExecutor<R extends Runnable> extends Object implements MessageListener<R>, Executor
Modifier and Type | Field and Description |
---|---|
private int |
executionsInProgress |
private static Logger |
LOGGER |
private String |
name |
private Queue<R> |
tasks |
Modifier | Constructor and Description |
---|---|
protected |
ThreadExecutor(String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
cancelTasks() |
protected abstract boolean |
canExecute(R task) |
protected abstract R |
createTask(Runnable runnable) |
void |
execute(Runnable runnable) |
protected void |
executeTask(R task) |
String |
getName() |
int |
getTaskCount() |
protected abstract Thread |
getThread() |
boolean |
isOnThread() |
protected boolean |
runTask() |
protected void |
runTasks() |
void |
runTasks(BooleanSupplier stopCondition) |
void |
send(R r) |
protected boolean |
shouldExecuteAsync() |
CompletableFuture<Void> |
submit(Runnable task) |
<V> CompletableFuture<V> |
submit(Supplier<V> task) |
void |
submitAndJoin(Runnable runnable) |
private CompletableFuture<Void> |
submitAsync(Runnable runnable) |
protected void |
waitForTasks() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
ask, close, create, method_27918
private static final Logger LOGGER
private final String name
private int executionsInProgress
protected ThreadExecutor(String name)
protected abstract boolean canExecute(R task)
public boolean isOnThread()
protected abstract Thread getThread()
protected boolean shouldExecuteAsync()
public int getTaskCount()
public String getName()
getName
in interface MessageListener<R extends Runnable>
@Environment(value=CLIENT) public <V> CompletableFuture<V> submit(Supplier<V> task)
private CompletableFuture<Void> submitAsync(Runnable runnable)
public CompletableFuture<Void> submit(Runnable task)
public void submitAndJoin(Runnable runnable)
public void send(R r)
send
in interface MessageListener<R extends Runnable>
@Environment(value=CLIENT) protected void cancelTasks()
protected void runTasks()
protected boolean runTask()
public void runTasks(BooleanSupplier stopCondition)
protected void waitForTasks()
protected void executeTask(R task)