Close async tasks properly when shutting down

This commit is contained in:
Frank van der Heijden 2020-07-27 01:02:50 +02:00
parent 62ec9c99ef
commit b47db98420
No known key found for this signature in database
GPG key ID: 26DA56488D314D11
4 changed files with 83 additions and 23 deletions

View file

@ -12,12 +12,17 @@ public class BungeeTaskManager extends AbstractTaskManager<ScheduledTask> {
}
@Override
public void runTask(Runnable runnable) {
runTaskAsynchronously(runnable);
protected ScheduledTask runTaskImpl(Runnable runnable) {
return runTaskAsynchronously(runnable);
}
@Override
public void runTaskAsynchronously(Runnable runnable) {
ProxyServer.getInstance().getScheduler().runAsync(ServerUtils.getInstance(), runnable);
protected ScheduledTask runTaskAsynchronouslyImpl(Runnable runnable) {
return ProxyServer.getInstance().getScheduler().runAsync(ServerUtils.getInstance(), runnable);
}
@Override
public void cancelTask(ScheduledTask task) {
task.cancel();
}
}