This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Propagate exceptions for submitted/scheduled tasks#727
Closed
tbruyelle wants to merge 1 commit intoandroidannotations:developfrom
Closed
Propagate exceptions for submitted/scheduled tasks#727tbruyelle wants to merge 1 commit intoandroidannotations:developfrom
tbruyelle wants to merge 1 commit intoandroidannotations:developfrom
Conversation
Contributor
|
This should work yes, but I still don't like this solution, even if I haven't a better idea right now :/ Note: you should update your pull-request. There are some conflicts right now |
Contributor
Author
|
Ok I didn't know you didn't like the solution, so I finally decided to create the PR in order to up the thing. The issue about invisible exceptions is a real problem for me because I want to keep track of all unexpected exceptions (like every java developer I presume :)). That says, I also don't appreciate a lot the solution, I hope someone could find a better one. |
Contributor
|
We should brainstorm on this point. In the meantime, I think we should keep this PR opened in case someone needs it. |
Closed
Contributor
|
We merged @JoanZapata 's PR. Thanks anyway :) |
Contributor
Author
|
Np this is a better solution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix improvement for #646
For remind, the goal of #646 was to stop catching exception in
@Backgoundannotated methods, in order to let the user deals with it.First shot was to simply remove the try/catch blocks, but as discussed here, there is a problem because
ExecutorService.submit/scheduledoesn't propagate exception during executions. This is by design. As a result, exceptions thrown are not logged and not visible.To handle that, I suggest a solution :
Call
futur.get()(in another thread pool) to check if an exception occurred during execution. If yes then throw it so it could be caught by the system.I admit it looks like a nasty trick, but I didn't find a better solution. If someone has, I will be happy to read it.