Interface IPublicPromaCallInvokerSync

    • Method Detail

      • extractResultSync

        <T,​R> R extractResultSync​(StageChain<T,​R> responseStage,
                                        Function<? super T,​? extends R> fn,
                                        Duration timeout)
                                 throws InterruptedException,
                                        ExecutionException,
                                        TimeoutException
        Extracts the result from a response stage by blocking until the response stage completes.
        Type Parameters:
        T - Type of the intermediate result.
        R - Type of the final result.
        Parameters:
        responseStage - The response stage from which to extract the final result.
        fn - A function for converting the intermediate result into the final result if the stage has not yet returned.
        timeout - The timeout until a TimeoutException is thrown if the stage does not complete within that time frame.
        Returns:
        The final result of the stage.
        Throws:
        InterruptedException - When this thread was interrupted while waiting for the stage to complete.
        ExecutionException - When the stage completed exceptionally.
        TimeoutException - When the stage did not complete within the given time frame.
      • extractResultSync

        default <T> T extractResultSync​(StageChain<T,​T> responseStage,
                                        Duration timeout)
                                 throws InterruptedException,
                                        ExecutionException,
                                        TimeoutException
        Extracts the result from a response stage by blocking until the response stage completes.
        Type Parameters:
        T - Type of the intermediate and final result.
        Parameters:
        responseStage - The response stage from which to extract the final result.
        timeout - The timeout until a TimeoutException is thrown if the stage does not complete within that time frame.
        Returns:
        The final result of the stage.
        Throws:
        InterruptedException - When this thread was interrupted while waiting for the stage to complete.
        ExecutionException - When the stage completed exceptionally.
        TimeoutException - When the stage did not complete within the given time frame.
      • extractResultSyncOr

        default <T,​R> R extractResultSyncOr​(StageChain<T,​R> responseStage,
                                                  Function<? super T,​? extends R> fn,
                                                  Function<Throwable,​R> onError,
                                                  Duration timeout)
        Same as extractResultSync(StageChain, Function, Duration), but handles error by invoking the given error handler and returning that result instead.
        Type Parameters:
        T - Type of the intermediate and final result.
        R - Type of the final result.
        Parameters:
        responseStage - The response stage from which to extract the final result.
        fn - A function for converting the intermediate result into the final result if the stage has not yet returned.
        onError - A function for recovering errors.
        timeout - The timeout until a TimeoutException is thrown if the stage does not complete within that time frame.
        Returns:
        The final result of the stage.
      • extractResultSyncOr

        default <T> T extractResultSyncOr​(StageChain<T,​T> responseStage,
                                          Function<Throwable,​T> onError,
                                          Duration timeout)
        Same as extractResultSync(StageChain, Duration), but handles error by invoking the given error handler and returning that result instead.
        Type Parameters:
        T - Type of the intermediate and final result.
        Parameters:
        responseStage - The response stage from which to extract the final result.
        onError - A function for recovering errors.
        timeout - The timeout until a TimeoutException is thrown if the stage does not complete within that time frame.
        Returns:
        The final result of the stage.