Package de.xima.fc.proma.context
Interface IPublicPromaCallInvokerSync
- All Superinterfaces:
IPublicPromaCallInvoker
A
IPublicPromaCallInvoker
that provides the result in a synchronous, blocking fashion.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescription<T,
R> R extractResultSync
(StageChain<T, R> responseStage, Function<? super T, ? extends R> fn, Duration timeout) Extracts the result from a response stage by blocking until the response stage completes.default <T> T
extractResultSync
(StageChain<T, T> responseStage, Duration timeout) Extracts the result from a response stage by blocking until the response stage completes.default <T,
R> R extractResultSyncOr
(StageChain<T, R> responseStage, Function<? super T, ? extends R> fn, Function<Throwable, R> onError, Duration timeout) Same asextractResultSync(StageChain, Function, Duration)
, but handles error by invoking the given error handler and returning that result instead.default <T> T
extractResultSyncOr
(StageChain<T, T> responseStage, Function<Throwable, T> onError, Duration timeout) Same asextractResultSync(StageChain, Duration)
, but handles error by invoking the given error handler and returning that result instead.Methods inherited from interface de.xima.fc.proma.context.IPublicPromaCallInvoker
invoke, invoke
-
Method Details
-
extractResultSync
<T,R> R extractResultSync(StageChain<T, R> responseStage, Function<? super T, throws InterruptedException, ExecutionException, TimeoutException? extends R> fn, Duration timeout) 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 aTimeoutException
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, TimeoutExceptionExtracts 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 aTimeoutException
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 asextractResultSync(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 aTimeoutException
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 asextractResultSync(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 aTimeoutException
is thrown if the stage does not complete within that time frame.- Returns:
- The final result of the stage.
-