takraj commented on code in PR #1163:
URL: https://github.com/apache/plc4x/pull/1163#discussion_r1365403231
##########
plc4j/spi/src/main/java/org/apache/plc4x/java/spi/ConversationContext.java:
##########
@@ -92,6 +93,8 @@ interface ContextHandler {
void cancel();
+ void awaitResponse() throws InterruptedException, ExecutionException;
Review Comment:
Yea, it's pretty much like a regular `Future`. The implementor
`DefaultContextHandler` is basically only a proxy of another `Future` (i.e.
`HandlerRegistration`), but seems to also trigger a callback, when cancelled.
I'm not sure if we can get rid of that... But still, it could simply implement
the normal `Future<Void>` interface instead of this one, and could be renamed
to something like `CancellationObserverFuture` (?).
Did you think of something like this?
It would be even better if this `Future` could contain the response, and
would `completeExceptionally()` in case of error/timeout. So instead of
specifying a callback for these events, one could wait on the future, and then
continue with processing the response.
--
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]