Skip to content

Commit b3fb6a8

Browse files
committed
Avoid unnecessary call to Promises.dependent in DependentPromise code
1 parent f61374a commit b3fb6a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/net/tascalate/concurrent/DependentPromise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public DependentPromise<T> orTimeout(Duration duration, boolean cancelOnTimeout)
158158
public DependentPromise<T> orTimeout(Duration duration, boolean cancelOnTimeout, boolean enlistOrigin) {
159159
Promise<T> onTimeout = Promises.failAfter(duration);
160160
// Use *async to execute on default "this" executor
161-
return Promises.dependent(this).applyToEitherAsync(
161+
return applyToEitherAsync(
162162
onTimeout,
163163
v -> {
164164
if (cancelOnTimeout) {
@@ -221,7 +221,7 @@ public DependentPromise<T> onTimeout(Supplier<T> supplier, Duration duration, bo
221221
// timeout converted to supplier
222222
Promise<Supplier<T>> onTimeout = Promises.dependent(Promises.delay(duration)).thenApply(d -> supplier, true);
223223

224-
return Promises.dependent(this)
224+
return this
225225
// resolved value converted to supplier
226226
.thenApply(valueToSupplier, enlistOrigin)
227227
// Use *async to execute on default "this" executor

0 commit comments

Comments
 (0)