@@ -121,18 +121,18 @@ public synchronized CompletableFuture<ExecutionResult<R>> apply(AsyncExecutionIn
121121 * supplier}, records the result and returns a promise containing the result.
122122 *
123123 * @param <R> result type
124+ * @throws UnsupportedOperationException when using
124125 */
125126 @ SuppressWarnings ("unchecked" )
126127 static <R > Function <AsyncExecutionInternal <R >, CompletableFuture <ExecutionResult <R >>> getPromiseOfStage (
127- ContextualSupplier <R , ? extends CompletionStage <? extends R >> supplier , FailsafeFuture <R > future ,
128- Executor executor ) {
128+ ContextualSupplier <R , ? extends CompletionStage <? extends R >> supplier , FailsafeFuture <R > future ) {
129129
130130 Assert .notNull (supplier , "supplier" );
131131 return execution -> {
132132 CompletableFuture <ExecutionResult <R >> promise = new CompletableFuture <>();
133133 try {
134134 execution .preExecute ();
135- CompletionStage <? extends R > stage = withExecutor ( supplier , executor ) .get (execution );
135+ CompletionStage <? extends R > stage = supplier .get (execution );
136136
137137 // Propagate outer cancellations to the stage
138138 if (stage instanceof Future )
@@ -163,15 +163,15 @@ static <R> Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult
163163 */
164164 @ SuppressWarnings ("unchecked" )
165165 static <R > Function <AsyncExecutionInternal <R >, CompletableFuture <ExecutionResult <R >>> getPromiseOfStageExecution (
166- AsyncSupplier <R , ? extends CompletionStage <? extends R >> supplier , FailsafeFuture <R > future , Executor executor ) {
166+ AsyncSupplier <R , ? extends CompletionStage <? extends R >> supplier , FailsafeFuture <R > future ) {
167167
168168 Assert .notNull (supplier , "supplier" );
169169 Semaphore asyncFutureLock = new Semaphore (1 );
170170 return execution -> {
171171 try {
172172 execution .preExecute ();
173173 asyncFutureLock .acquire ();
174- CompletionStage <? extends R > stage = withExecutor ( supplier , executor ) .get (execution );
174+ CompletionStage <? extends R > stage = supplier .get (execution );
175175
176176 // Propagate outer cancellations to the stage
177177 if (stage instanceof Future )
@@ -305,19 +305,6 @@ static <R> AsyncRunnable<R> withExecutor(AsyncRunnable<R> runnable, Executor exe
305305 };
306306 }
307307
308- static <R , T > AsyncSupplier <R , T > withExecutor (AsyncSupplier <R , T > supplier , Executor executor ) {
309- return executor == null ? supplier : exec -> {
310- executor .execute (() -> {
311- try {
312- supplier .get (exec );
313- } catch (Throwable e ) {
314- handleExecutorThrowablen (e );
315- }
316- });
317- return null ;
318- };
319- }
320-
321308 private static void handleExecutorThrowablen (Throwable e ) {
322309 if (e instanceof RuntimeException )
323310 throw (RuntimeException ) e ;
0 commit comments