From eb1b63984deb55bbfd9e25b2deacf56039d8e663 Mon Sep 17 00:00:00 2001 From: Arachne <66822642+Arachneee@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:31:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A9=80=ED=8B=B0=EC=8A=A4=EB=A0=88?= =?UTF-8?q?=EB=93=9C=20=EC=A2=85=EB=A3=8C=20=EC=8B=9C=20=EC=9E=90=EC=9B=90?= =?UTF-8?q?=20=EB=B0=98=EB=82=A9=20=EB=8C=80=EA=B8=B0=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/haengdong/event/config/S3Config.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/main/java/haengdong/event/config/S3Config.java b/server/src/main/java/haengdong/event/config/S3Config.java index dee5499b..2a5bd91e 100644 --- a/server/src/main/java/haengdong/event/config/S3Config.java +++ b/server/src/main/java/haengdong/event/config/S3Config.java @@ -3,6 +3,7 @@ import jakarta.annotation.PreDestroy; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import software.amazon.awssdk.regions.Region; @@ -12,6 +13,7 @@ public class S3Config { private static final int THREAD_POOL_SIZE = 10; + private static final int LIFE_CYCLE_SHUTDOWN_TIME_SEC = 10; private final ExecutorService executorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE); @@ -30,5 +32,13 @@ public ExecutorService executorService() { @PreDestroy public void shutdown() { executorService.shutdown(); + try { + if (!executorService.awaitTermination(LIFE_CYCLE_SHUTDOWN_TIME_SEC, TimeUnit.SECONDS)) { + executorService.shutdownNow(); + } + } catch (InterruptedException e) { + executorService.shutdownNow(); + Thread.currentThread().interrupt(); + } } }