Skip to content

Commit 0426ffa

Browse files
authored
Remove default implementation of wrapTask(Runnable) (#1570)
1 parent b2bc780 commit 0426ffa

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

tracing/src/main/java/com/palantir/tracing/WrappingExecutorService.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.concurrent.Callable;
2525
import java.util.concurrent.ExecutionException;
2626
import java.util.concurrent.ExecutorService;
27-
import java.util.concurrent.Executors;
2827
import java.util.concurrent.Future;
2928
import java.util.concurrent.TimeUnit;
3029
import java.util.concurrent.TimeoutException;
@@ -51,27 +50,14 @@ protected WrappingExecutorService(ExecutorService delegate) {
5150
}
5251

5352
/**
54-
* Wraps a {@code Callable} for submission to the underlying executor. This method is also applied to any
55-
* {@code Runnable} passed to the default implementation of {@link #wrapTask(Runnable)}.
53+
* Wraps a {@code Callable} for submission to the underlying executor.
5654
*/
5755
protected abstract <T> Callable<T> wrapTask(Callable<T> callable);
5856

5957
/**
60-
* Wraps a {@code Runnable} for submission to the underlying executor. The default implementation delegates to
61-
* {@link #wrapTask(Callable)}.
58+
* Wraps a {@code Runnable} for submission to the underlying executor.
6259
*/
63-
protected Runnable wrapTask(Runnable command) {
64-
final Callable<Object> wrapped = wrapTask(Executors.callable(command, null));
65-
return () -> {
66-
try {
67-
wrapped.call();
68-
} catch (RuntimeException | Error e) {
69-
throw e;
70-
} catch (Exception e) {
71-
throw new RuntimeException(e);
72-
}
73-
};
74-
}
60+
protected abstract Runnable wrapTask(Runnable command);
7561

7662
/**
7763
* Wraps a collection of tasks.

0 commit comments

Comments
 (0)