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) {
if (!registeredTasks.checkedRemove(task.id()))
throw new IllegalStateException("Task is not scheduled");
this.registeredTasks.remove(task.id());
}
synchronized boolean isTaskAlive(TaskImpl task) {