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

Small fixes for Async with CompletionStage #299

Merged
merged 12 commits into from
Sep 7, 2018

Conversation

Azquelt
Copy link
Member

@Azquelt Azquelt commented Aug 7, 2018

Fixes on top of #267 in response to issues raised in that PR.

Note that at the moment, this PR includes everything in #267. If #267 is merged, I'll rebase this so it only includes my changes.

Ondrej Mihalyi and others added 10 commits May 2, 2018 12:07
Signed-off-by:Ondrej Mihalyi <ondrej.mihalyi@payara.fish>
Signed-off-by:Ondrej Mihalyi <ondrej.mihalyi@payara.fish>
Signed-off-by:Ondrej Mihalyi <ondrej.mihalyi@payara.fish>
 - removed the CompletedFuture class from the Asynchronous annotation
 - added a CF helper to the TCK
 - fix for calls of stage.toCompletableFuture which may not always be implemented
 - fixes in Javadocs
Signed-off-by:Ondrej Mihalyi <ondrej.mihalyi@payara.fish>
Signed-off-by:Ondrej Mihalyi <ondrej.mihalyi@payara.fish>
Replace isCompleted checks with completesQuickly checks to avoid a race
condition where asynchronous tasks may not complete immediately, but
should complete very quickly.

Also include the original exception as the cause when raising an
AssertionError in response to a CompletionException.

Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
Clean up the language around the behaviour when a class is annotated
with Asynchronous.

Clarify when the FaultToleranceDefinitionException is thrown.

Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
Ensure that a DefinitionException is thrown if an invalid Asynchronous
method is deployed.

Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
Include the CompletableFutureHelper in the test application

Separate the future that we complete from the one that the user's method
returns. Otherwise we set up a thenApply to get a new CompletionStage,
then we manually complete that new stage which means the thenApply never
runs. We need to complete the original CompletionStage instead.

Assert properly on exceptions thrown from future.get(). Need to assert
that an ExecutionException is thrown and that the cause is the exception
thrown from the user's method.

Avoid calling waitUntilCompleted after asserting that future.get()
throws an exception. We don't need to wait at this point because calling
get() will wait for it to finish, and the waitUntilCompleted method will
always fail because we know the future completed exceptionally.
All methods in a class annotated with @asynchronous must return either
Future or CompletionStage.
Based on feedback on the 2018-8-15 call.

Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
@brunobat
Copy link
Contributor

@Emily-Jiang Did review on this PR and the previous #267. It looks good.

@Emily-Jiang
Copy link
Member

As discussed on our hangout last week and this week, I will merge this as I have done 1.1.2 release.

@Emily-Jiang Emily-Jiang merged commit bbcd148 into eclipse:master Sep 7, 2018
@Azquelt Azquelt deleted the issue110-async-with-cs branch November 27, 2018 16:45
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.

3 participants