diff --git a/src/main/java/net/minestom/server/timer/SchedulerManager.java b/src/main/java/net/minestom/server/timer/SchedulerManager.java index a05ef7dc2..8c5ce4305 100644 --- a/src/main/java/net/minestom/server/timer/SchedulerManager.java +++ b/src/main/java/net/minestom/server/timer/SchedulerManager.java @@ -184,9 +184,9 @@ public final class SchedulerManager implements IExtensionObserver { } /** - * Gets the execution service for all the registered {@link Task}, which are not marked as thread-bound. + * Gets the execution service for all the registered {@link Task} * - * @return the execution service for all the registered {@link Task}, which are not marked as thread-bound + * @return the execution service for all the registered {@link Task} */ @NotNull public ExecutorService getBatchesPool() { diff --git a/src/main/java/net/minestom/server/timer/Task.java b/src/main/java/net/minestom/server/timer/Task.java index 397170bd1..63308058e 100644 --- a/src/main/java/net/minestom/server/timer/Task.java +++ b/src/main/java/net/minestom/server/timer/Task.java @@ -43,8 +43,6 @@ public class Task implements Runnable { private ScheduledFuture future; // The thread of the task private volatile Thread currentThreadTask; - // The executor service used for this task - private final ExecutorService executorService; /** * Creates a task. @@ -60,7 +58,6 @@ public class Task implements Runnable { this.runnable = runnable; this.shutdown = shutdown; this.id = shutdown ? this.schedulerManager.getShutdownCounterIdentifier() : this.schedulerManager.getCounterIdentifier(); - this.executorService = this.schedulerManager.getBatchesPool(); this.delay = delay; this.repeat = repeat; this.isTransient = isTransient; @@ -72,7 +69,7 @@ public class Task implements Runnable { */ @Override public void run() { - executorService.execute(() -> { + this.schedulerManager.getBatchesPool().execute(() -> { this.currentThreadTask = Thread.currentThread(); try { this.runnable.run();