From 2fb5497a49a61a8c832ff35497a224ae5b173697 Mon Sep 17 00:00:00 2001 From: MDong <1191998028@qq.com> Date: Thu, 27 Apr 2023 14:46:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:UDP=E5=85=B3=E9=97=AD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/smartboot/socket/transport/Worker.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aio-pro/src/main/java/org/smartboot/socket/transport/Worker.java b/aio-pro/src/main/java/org/smartboot/socket/transport/Worker.java index 733591d9..f99efcbe 100644 --- a/aio-pro/src/main/java/org/smartboot/socket/transport/Worker.java +++ b/aio-pro/src/main/java/org/smartboot/socket/transport/Worker.java @@ -183,6 +183,9 @@ public final class Worker implements Runnable { return true; } + private static final Long timeout = 1000L; + + private static final TimeUnit timeUnit = TimeUnit.MILLISECONDS; void shutdown() { try { @@ -193,8 +196,9 @@ public final class Worker implements Runnable { selector.wakeup(); executorService.shutdown(); try { + executorService.awaitTermination(timeout, timeUnit); selector.close(); - } catch (IOException e) { + } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } } -- Gitee