From 715fb9f54082ff45ab0a4b8ae3c7b997f4033899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=A6=D1=8B=D0=BF?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 25 Sep 2024 14:33:24 +0300 Subject: [PATCH] Use newCachedTreadPool() instead of newSingleThreadExecutor() in InetUtils (#1365) Co-authored-by: tsypanovs --- .../org/springframework/cloud/commons/util/InetUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java index c1eb10318..87a5953c0 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,10 @@ /** * @author Spencer Gibb + * @author Sergey Tsypanov */ public class InetUtils implements Closeable { - // TODO: maybe shutdown the thread pool if it isn't being used? private final ExecutorService executorService; private final InetUtilsProperties properties; @@ -47,7 +47,7 @@ public class InetUtils implements Closeable { public InetUtils(final InetUtilsProperties properties) { this.properties = properties; - this.executorService = Executors.newSingleThreadExecutor(r -> { + this.executorService = Executors.newCachedThreadPool(r -> { Thread thread = new Thread(r); thread.setName(InetUtilsProperties.PREFIX); thread.setDaemon(true);