Do not throw an exception if the task is not registered

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-16 19:03:47 +01:00
parent 9af41f944a
commit f0104f7f1d

View File

@ -82,8 +82,7 @@ final class SchedulerImpl implements Scheduler {
} }
synchronized void cancelTask(TaskImpl task) { synchronized void cancelTask(TaskImpl task) {
if (!registeredTasks.checkedRemove(task.id())) this.registeredTasks.remove(task.id());
throw new IllegalStateException("Task is not scheduled");
} }
synchronized boolean isTaskAlive(TaskImpl task) { synchronized boolean isTaskAlive(TaskImpl task) {