From d8f77d5057e9993c4f23aecb610bb756ed39de51 Mon Sep 17 00:00:00 2001 From: Sjoerd Talsma Date: Fri, 15 Nov 2024 11:39:11 +0100 Subject: [PATCH] Review fixes (#520) * Fix module names. * Fix (and simplify) wrapTasks method. --------- Signed-off-by: Sjoerd Talsma --- .../core/delegation/DelegatingExecutorService.java | 13 ++++--------- timers/context-timer-micrometer/pom.xml | 2 +- timers/context-timer-opentelemetry/pom.xml | 2 +- timers/context-timer-opentracing/pom.xml | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/context-propagation-core/src/main/java/nl/talsmasoftware/context/core/delegation/DelegatingExecutorService.java b/context-propagation-core/src/main/java/nl/talsmasoftware/context/core/delegation/DelegatingExecutorService.java index f684dfcf..211a8c5a 100644 --- a/context-propagation-core/src/main/java/nl/talsmasoftware/context/core/delegation/DelegatingExecutorService.java +++ b/context-propagation-core/src/main/java/nl/talsmasoftware/context/core/delegation/DelegatingExecutorService.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Objects; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -74,18 +73,14 @@ protected Future wrap(Future source) { * @see #wrap(Callable) */ protected Collection> wrapTasks(Collection> tasks) { - Collection> wrappedTasks = tasks; if (tasks != null && !tasks.isEmpty()) { - boolean modification = false; - final List> copy = new ArrayList>(tasks.size()); + final List> wrappedTasks = new ArrayList<>(tasks.size()); for (Callable task : tasks) { - final Callable wrapped = wrap(task); - modification |= (task == wrapped || Objects.equals(task, wrapped)); - copy.add(wrapped); + wrappedTasks.add(wrap(task)); } - if (modification) wrappedTasks = copy; + tasks = wrappedTasks; } - return wrappedTasks; + return tasks; } /** diff --git a/timers/context-timer-micrometer/pom.xml b/timers/context-timer-micrometer/pom.xml index 3b7874fb..88277756 100644 --- a/timers/context-timer-micrometer/pom.xml +++ b/timers/context-timer-micrometer/pom.xml @@ -35,7 +35,7 @@ jar - ${project.groupId}.metrics + ${project.groupId}.micrometer ${project.parent.basedir} 1.14.0 diff --git a/timers/context-timer-opentelemetry/pom.xml b/timers/context-timer-opentelemetry/pom.xml index 622deaa1..c4b17775 100644 --- a/timers/context-timer-opentelemetry/pom.xml +++ b/timers/context-timer-opentelemetry/pom.xml @@ -35,7 +35,7 @@ jar - ${project.groupId}.metrics + ${project.groupId}.opentelemetry ${project.parent.basedir} diff --git a/timers/context-timer-opentracing/pom.xml b/timers/context-timer-opentracing/pom.xml index 2b401270..88109165 100644 --- a/timers/context-timer-opentracing/pom.xml +++ b/timers/context-timer-opentracing/pom.xml @@ -35,7 +35,7 @@ jar - ${project.groupId}.metrics + ${project.groupId}.opentracing ${project.parent.basedir}