He-Pin opened a new pull request, #3137:
URL: https://github.com/apache/pekko/pull/3137
### Motivation
`FutureTimeoutSupport.timeoutCompletionStage` was `@deprecated("Use
CompletableFuture#orTimeout instead.", "2.0.0")` but still used a manual
`Scheduler`-based implementation internally with `scheduleOnce` +
`completeExceptionally(new TimeoutException(...))`.
### Modification
Rewrite `timeoutCompletionStage` to delegate to
`CompletableFuture.orTimeout()`. A `handle()` wrapper provides a consistent
timeout message (`"Timeout of $duration expired"`) across JDK versions — JDK
25's `orTimeout` produces a null `TimeoutException` message, unlike JDK 17
which included a descriptive message. The `Scheduler` parameter is retained for
API compatibility but no longer used.
### Result
- Simpler implementation (~5 fewer lines)
- No `Scheduler` dependency for timeout scheduling (uses JDK shared
`ForkJoinPool`)
- Consistent timeout exception messages across JDK versions
- `orTimeout` still cancels the underlying future on timeout (same behavior
as before)
### Tests
- `sbt "actor-tests / Test / testOnly
org.apache.pekko.pattern.PatternsTest"` — 33/33 passed
### References
Refs #3136
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]