Package top.focess.qq.core.schedule
Class ThreadPoolScheduler
- java.lang.Object
-
- top.focess.qq.core.schedule.AScheduler
-
- top.focess.qq.core.schedule.ThreadPoolScheduler
-
- All Implemented Interfaces:
Scheduler
public class ThreadPoolScheduler extends AScheduler
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolScheduler(Plugin plugin, int poolSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel(top.focess.qq.core.schedule.ITask task)voidcancelAll()Cancel all the tasksvoidclose()Close this schedulerStringgetName()Get the name of the schedulerbooleanisClosed()Indicate whether this scheduler is closed or notvoidrecreate(String name)voidrerun(top.focess.qq.core.schedule.ITask task)Taskrun(Runnable runnable, java.time.Duration delay)Run a task laterTaskrunTimer(Runnable runnable, java.time.Duration delay, java.time.Duration period)Run a task timer<V> Callback<V>submit(Callable<V> callable, java.time.Duration delay)Submit a task laterStringtoString()-
Methods inherited from class top.focess.qq.core.schedule.AScheduler
close, closeAll, getPlugin
-
-
-
-
Constructor Detail
-
ThreadPoolScheduler
public ThreadPoolScheduler(Plugin plugin, int poolSize)
-
-
Method Detail
-
run
public Task run(Runnable runnable, java.time.Duration delay)
Description copied from interface:SchedulerRun a task later- Parameters:
runnable- the taskdelay- the delay- Returns:
- the warped task
-
runTimer
public Task runTimer(Runnable runnable, java.time.Duration delay, java.time.Duration period)
Description copied from interface:SchedulerRun a task timer- Parameters:
runnable- the taskdelay- the delayperiod- the period- Returns:
- the warped task
-
submit
public <V> Callback<V> submit(Callable<V> callable, java.time.Duration delay)
Description copied from interface:SchedulerSubmit a task later- Type Parameters:
V- the return type- Parameters:
callable- the taskdelay- the delay- Returns:
- the warped task
-
cancelAll
public void cancelAll()
Description copied from interface:SchedulerCancel all the tasks
-
getName
public String getName()
Description copied from interface:SchedulerGet the name of the scheduler- Returns:
- the name of the scheduler
-
close
public void close()
Description copied from interface:SchedulerClose this scheduler- Specified by:
closein interfaceScheduler- Overrides:
closein classAScheduler
-
isClosed
public boolean isClosed()
Description copied from interface:SchedulerIndicate whether this scheduler is closed or not- Returns:
- true if this scheduler is closed, false otherwise
-
cancel
public void cancel(top.focess.qq.core.schedule.ITask task)
-
recreate
public void recreate(String name)
-
rerun
public void rerun(top.focess.qq.core.schedule.ITask task)
-
-