From d80f749dbd797df734a32bee9e1b77c1e4f62d13 Mon Sep 17 00:00:00 2001 From: Patrick Koenig Date: Thu, 30 Oct 2025 16:51:44 -0400 Subject: [PATCH] Remove default implementation of wrapTask(Runnable) --- .../tracing/WrappingExecutorService.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tracing/src/main/java/com/palantir/tracing/WrappingExecutorService.java b/tracing/src/main/java/com/palantir/tracing/WrappingExecutorService.java index 6e4abcace..f6020a038 100644 --- a/tracing/src/main/java/com/palantir/tracing/WrappingExecutorService.java +++ b/tracing/src/main/java/com/palantir/tracing/WrappingExecutorService.java @@ -24,7 +24,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -51,27 +50,14 @@ protected WrappingExecutorService(ExecutorService delegate) { } /** - * Wraps a {@code Callable} for submission to the underlying executor. This method is also applied to any - * {@code Runnable} passed to the default implementation of {@link #wrapTask(Runnable)}. + * Wraps a {@code Callable} for submission to the underlying executor. */ protected abstract Callable wrapTask(Callable callable); /** - * Wraps a {@code Runnable} for submission to the underlying executor. The default implementation delegates to - * {@link #wrapTask(Callable)}. + * Wraps a {@code Runnable} for submission to the underlying executor. */ - protected Runnable wrapTask(Runnable command) { - final Callable wrapped = wrapTask(Executors.callable(command, null)); - return () -> { - try { - wrapped.call(); - } catch (RuntimeException | Error e) { - throw e; - } catch (Exception e) { - throw new RuntimeException(e); - } - }; - } + protected abstract Runnable wrapTask(Runnable command); /** * Wraps a collection of tasks.