He-Pin opened a new pull request, #2812: URL: https://github.com/apache/pekko/pull/2812
## Motivation The `fromTry` and `fromTryKeepException` methods (added in #2796) use `scala.util.Try`, which is not idiomatic for Java users. Java users need a convenient way to convert a computation result into a `StatusReply` without manually wrapping try-catch blocks. ## Modification Added two new Java-friendly factory methods to `StatusReply`: - `fromCallable[T](callable: Callable[T])`: Wraps the callable result or converts exception message to error (safe for remote serialization). - `fromCallableKeepException[T](callable: Callable[T])`: Wraps the callable result or keeps the original exception. Added corresponding test cases in `StatusReplySpec`. ## Result Java users can now use `StatusReply.fromCallable(() -> computeValue())` instead of manual try-catch + StatusReply.success/error patterns. ## References - Follow-up to #2796 (StatusReply.fromTry factories). - Follows Pekko convention of providing Java-friendly alternatives for Scala-specific types (Try → Callable). -- 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]
