From 8105e8eb4ed6dfa43c922576a5f36a73fadba2e5 Mon Sep 17 00:00:00 2001 From: Sergei Egorov Date: Tue, 10 Apr 2018 07:45:09 +0200 Subject: [PATCH 1/3] Mark Timeouts' thread as daemon and name it --- .../java/org/rnorth/ducttape/timeouts/Timeouts.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/rnorth/ducttape/timeouts/Timeouts.java b/src/main/java/org/rnorth/ducttape/timeouts/Timeouts.java index 02c3382..7737125 100644 --- a/src/main/java/org/rnorth/ducttape/timeouts/Timeouts.java +++ b/src/main/java/org/rnorth/ducttape/timeouts/Timeouts.java @@ -3,6 +3,7 @@ import org.jetbrains.annotations.NotNull; import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; import static org.rnorth.ducttape.Preconditions.check; @@ -11,7 +12,17 @@ */ public class Timeouts { - private static final ExecutorService EXECUTOR_SERVICE = Executors.newCachedThreadPool(); + private static final ExecutorService EXECUTOR_SERVICE = Executors.newCachedThreadPool(new ThreadFactory() { + + final AtomicInteger threadCounter = new AtomicInteger(0); + + @Override + public Thread newThread(@NotNull Runnable r) { + Thread thread = new Thread(r, "ducttape-" + threadCounter.getAndIncrement()); + thread.setDaemon(true); + return thread; + } + }); /** * Execute a lambda expression with a timeout. If it completes within the time, the result will be returned. From 0a232ca808690fd4e00b90029f97e2382eb04a56 Mon Sep 17 00:00:00 2001 From: Sergei Egorov Date: Fri, 13 Apr 2018 11:23:18 +0200 Subject: [PATCH 2/3] Add to CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9fbaf..079a225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +* Mark Timeouts' thread as daemon and name it. ([#4](https://github.com/rnorth/duct-tape/pull/4)) + ## [1.0.5] - 2016-02-20 * Add retry-until-count option (as alternative to until timeout) to `Unreliables` From 1df849562a80f049e868e181854a4cddf5d458c0 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sat, 14 Apr 2018 07:36:29 +0100 Subject: [PATCH 3/3] Update release version and date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 079a225..52a6800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased +## [1.0.6] - 2018-04-14 * Mark Timeouts' thread as daemon and name it. ([#4](https://github.com/rnorth/duct-tape/pull/4))