replace sync with blocking since theres no sync

This commit is contained in:
Tofaa2 2024-07-08 18:36:48 +04:00
parent adff2d1937
commit 0c66a95a42
2 changed files with 2 additions and 4 deletions

View file

@ -46,9 +46,7 @@ class SchedulerImpl implements Scheduler {
TaskSchedule schedule = task.task.get();
if (schedule instanceof TaskSchedule.DurationSchedule) {
TaskSchedule.DurationSchedule d = (TaskSchedule.DurationSchedule) schedule;
SCHEDULED_EXECUTOR.schedule(() -> {
safeExecute(task);
}, d.duration.toMillis(), TimeUnit.MILLISECONDS);
SCHEDULED_EXECUTOR.schedule(() -> safeExecute(task), d.duration.toMillis(), TimeUnit.MILLISECONDS);
}
else if (schedule instanceof TaskSchedule.FutureSchedule) {
TaskSchedule.FutureSchedule f = (TaskSchedule.FutureSchedule) schedule;

View file

@ -20,7 +20,7 @@ public interface Task {
private final Runnable runnable;
private final Scheduler scheduler;
private ExecutionType executionType = ExecutionType.SYNC;//default
private ExecutionType executionType = ExecutionType.BLOCKING;//default
private TaskSchedule delay = TaskSchedule.immediate();
private TaskSchedule repeat = TaskSchedule.stop();