@@ -75,23 +75,6 @@ public final class JdkHttpSender implements HttpSender {
7575 @ Nullable private final RetryPolicy retryPolicy ;
7676 private final Predicate <IOException > retryExceptionPredicate ;
7777
78- /**
79- * Returns an {@link ExecutorService} using daemon threads.
80- *
81- * @param propagateContextForTesting For tests only. When enabled, the current thread's Context
82- * will be passed over to the new threads, this is useful for validating scenarios where
83- * context propagation is available through bytecode instrumentation.
84- */
85- public static ExecutorService newExecutor (boolean propagateContextForTesting ) {
86- return new ThreadPoolExecutor (
87- 0 ,
88- Integer .MAX_VALUE ,
89- 60 ,
90- TimeUnit .SECONDS ,
91- new SynchronousQueue <>(),
92- new DaemonThreadFactory ("jdkhttp-executor" , propagateContextForTesting ));
93- }
94-
9578 // Visible for testing
9679 JdkHttpSender (
9780 HttpClient client ,
@@ -102,8 +85,7 @@ public static ExecutorService newExecutor(boolean propagateContextForTesting) {
10285 long timeoutNanos ,
10386 Supplier <Map <String , List <String >>> headerSupplier ,
10487 @ Nullable RetryPolicy retryPolicy ,
105- @ Nullable ExecutorService executorService ,
106- boolean propagateContextForTesting ) {
88+ @ Nullable ExecutorService executorService ) {
10789 this .client = client ;
10890 try {
10991 this .uri = new URI (endpoint );
@@ -121,7 +103,7 @@ public static ExecutorService newExecutor(boolean propagateContextForTesting) {
121103 .map (RetryPolicy ::getRetryExceptionPredicate )
122104 .orElse (JdkHttpSender ::isRetryableException );
123105 if (executorService == null ) {
124- this .executorService = JdkHttpSender . newExecutor (propagateContextForTesting );
106+ this .executorService = newExecutor ();
125107 this .managedExecutor = true ;
126108 } else {
127109 this .executorService = executorService ;
@@ -150,8 +132,17 @@ public static ExecutorService newExecutor(boolean propagateContextForTesting) {
150132 timeoutNanos ,
151133 headerSupplier ,
152134 retryPolicy ,
153- executorService ,
154- /* propagateContextForTesting= */ false );
135+ executorService );
136+ }
137+
138+ private static ExecutorService newExecutor () {
139+ return new ThreadPoolExecutor (
140+ 0 ,
141+ Integer .MAX_VALUE ,
142+ 60 ,
143+ TimeUnit .SECONDS ,
144+ new SynchronousQueue <>(),
145+ new DaemonThreadFactory ("jdkhttp-executor" ));
155146 }
156147
157148 private static HttpClient configureClient (
0 commit comments