From 99eea0ad536ee946b4de16cbcef571069541652e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Amor=C3=ADn?= Date: Fri, 26 Jul 2024 11:22:33 -0300 Subject: [PATCH] Fix HashedWheelTimeoutScheduler removing scheduledFutures after task --- .../scheduler/HashedWheelTimeoutScheduler.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/corundumstudio/socketio/scheduler/HashedWheelTimeoutScheduler.java b/src/main/java/com/corundumstudio/socketio/scheduler/HashedWheelTimeoutScheduler.java index 4d5b8c74..27b90510 100644 --- a/src/main/java/com/corundumstudio/socketio/scheduler/HashedWheelTimeoutScheduler.java +++ b/src/main/java/com/corundumstudio/socketio/scheduler/HashedWheelTimeoutScheduler.java @@ -80,11 +80,8 @@ public void run(Timeout timeout) throws Exception { ctx.executor().execute(new Runnable() { @Override public void run() { - try { - runnable.run(); - } finally { - scheduledFutures.remove(key); - } + scheduledFutures.remove(key); + runnable.run(); } }); } @@ -98,11 +95,8 @@ public void schedule(final SchedulerKey key, final Runnable runnable, long delay Timeout timeout = executorService.newTimeout(new TimerTask() { @Override public void run(Timeout timeout) throws Exception { - try { - runnable.run(); - } finally { - scheduledFutures.remove(key); - } + scheduledFutures.remove(key); + runnable.run(); } }, delay, unit);