Skip to content

Commit 715fb9f

Browse files
stsypanovtsypanovs
andauthored
Use newCachedTreadPool() instead of newSingleThreadExecutor() in InetUtils (#1365)
Co-authored-by: tsypanovs <serhii.tsypanov@dxc.com>
1 parent 697b600 commit 715fb9f

File tree

1 file changed

+3
-3
lines changed
  • spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util

1 file changed

+3
-3
lines changed

spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,10 +35,10 @@
3535

3636
/**
3737
* @author Spencer Gibb
38+
* @author Sergey Tsypanov
3839
*/
3940
public class InetUtils implements Closeable {
4041

41-
// TODO: maybe shutdown the thread pool if it isn't being used?
4242
private final ExecutorService executorService;
4343

4444
private final InetUtilsProperties properties;
@@ -47,7 +47,7 @@ public class InetUtils implements Closeable {
4747

4848
public InetUtils(final InetUtilsProperties properties) {
4949
this.properties = properties;
50-
this.executorService = Executors.newSingleThreadExecutor(r -> {
50+
this.executorService = Executors.newCachedThreadPool(r -> {
5151
Thread thread = new Thread(r);
5252
thread.setName(InetUtilsProperties.PREFIX);
5353
thread.setDaemon(true);

0 commit comments

Comments
 (0)