From 01c1002249392d2a64d90bae603835202bce4bc2 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 26 Aug 2018 18:43:55 -0400 Subject: [PATCH] Make sure to schedule on the thread pool and not on the scheduler. --- .../proxy/scheduler/VelocityScheduler.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java index 7193e46ee..e3e7b342a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/scheduler/VelocityScheduler.java @@ -185,23 +185,25 @@ public class VelocityScheduler implements Scheduler { @Override public void cancel() { if (future != null) { - future.cancel(true); + future.cancel(false); onFinish(); } } @Override public void run() { - try { - runnable.run(); - } catch (Exception e) { - // Since we can't catch InterruptedException separately... - if (e instanceof InterruptedException) { - onFinish(); - } else { - Log.logger.error("Exception in task {} by plugin {}", runnable, plugin); + taskService.execute(() -> { + try { + runnable.run(); + } catch (Exception e) { + // Since we can't catch InterruptedException separately... + if (e instanceof InterruptedException) { + onFinish(); + } else { + Log.logger.error("Exception in task {} by plugin {}", runnable, plugin); + } } - } + }); } private void onFinish() {