package xyz.wbsite.frame.schedule;


import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import java.util.Date;
import java.util.concurrent.ScheduledFuture;

public abstract class RunTask implements Runnable {

    public abstract String taskId();

    public abstract ScheduledFuture<?> schedule(ThreadPoolTaskScheduler poolTaskScheduler);

    public void configChange(ThreadPoolTaskScheduler scheduler) {
        ScheduledFuture<?> schedule = scheduler.schedule(this, new Date());
        if (!schedule.cancel(true)) {

        }
    }
}
