Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes AtomicExecuteResultHandler to be a thin wrapper around CompletableFuture #121

Merged

Conversation

mosesn
Copy link
Contributor

@mosesn mosesn commented May 14, 2023

From the chat on a recent PR https://github.com/vorburger/ch.vorburger.exec/pull/110/files#r1193152562

This is a minimally invasive change to illustrate what I was saying about AtomicExecuteResultHandler feeling very similar to CompletableFuture. If I'm feeling up to it, I'll also put up a more invasive PR as an example to show what I meant by fully replacing it with CompletableFuture.

if (inner instanceof ExecuteException) {
return Optional.of((ExecuteException) inner);
} else {
return Optional.empty();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should never happen, and would be a bug if it did - agreed? How about something like:

Suggested change
return Optional.empty();
throw new IllegalStateException("BUG");

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually @mosesn let me just merge this as-is, and then follow-up with a PR for this...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #123

} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
// just swallow anything else
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upon reviewing this, I'm wondering if there was a bug in the original version... after an onProcessFailed(ExecuteException e) I guess we would expect a waitFor() to re-throw that? This won't do that - but nor did it before? Perhaps a unit test would be in order... are you interested to contribute one?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah no, I'm just stupid... you would NOT expect that behaviour from a waitFor()

@vorburger vorburger merged commit 553f73a into vorburger:master May 14, 2023
@vorburger vorburger mentioned this pull request May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants