RFR 8056249 Improve CompletableFuture resource usage
Hi, Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required). https://bugs.openjdk.java.net/browse/JDK-8056249 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8056249-cf-resource-usage/webre... -- Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync? If the supplied function itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally. Paul.
On 08/29/2014 06:01 AM, Paul Sandoz wrote:
Hi,
Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required).
https://bugs.openjdk.java.net/browse/JDK-8056249 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8056249-cf-resource-usage/webre...
Thanks for doing this!
Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync?
While touching up wording, we noticed that this sentence doesn't capture all the cases that are described in the top-level CompletionStage specs. So including it seems more confusing than omitting it, and just relying on the overall specs. -Doug
If the supplied function itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally.
Paul.
On Aug 29, 2014, at 3:35 PM, Doug Lea <dl@cs.oswego.edu> wrote:
Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync?
While touching up wording, we noticed that this sentence doesn't capture all the cases that are described in the top-level CompletionStage specs. So including it seems more confusing than omitting it, and just relying on the overall specs.
I got it now, on first look i missed the subtleties of the exception handling. Paul.
On 29/08/14 11:01, Paul Sandoz wrote:
Hi,
Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required).
IMHO, the rewording and clarifications in the docs do not warrant a CCC. From what I can see, these cases are already covered by JCK tests. In the case of handle() then the returned CF mush complete with the function's result, given the method signature. This is just the docs explicitly stating what is already a given.
https://bugs.openjdk.java.net/browse/JDK-8056249 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8056249-cf-resource-usage/webre...
--
Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync?
If the supplied function itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally.
I don't think so. Whether, or not, this CF completes exceptionally will have no impact of the result of the returned CF. You could add all of what you suggested less, "unless this stage also completed exceptionally", but I don't think that is even necessary. I think it is already covered by "the function's result is used to complete the returned stage", function's result could be an exception. But I guess you could be explicit. -Chris.
Paul.
On Aug 29, 2014, at 3:38 PM, Chris Hegarty <chris.hegarty@oracle.com> wrote:
On 29/08/14 11:01, Paul Sandoz wrote:
Hi,
Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required).
IMHO, the rewording and clarifications in the docs do not warrant a CCC.
Agreed it's just a clarification. Paul.
Looks fine. Instead of using Contributed-by: for Doug's work, you should make him the hg "user", as is done in previous changesets. E.g. hg import has a --user flag. All of jsr166 CVS src/main is ready for sync'ing with openjdk9, i.e. there are no known bugs, even though some future improvements are on the TODO list. On Fri, Aug 29, 2014 at 3:01 AM, Paul Sandoz <paul.sandoz@oracle.com> wrote:
Hi,
Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required).
https://bugs.openjdk.java.net/browse/JDK-8056249
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8056249-cf-resource-usage/webre...
--
Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync?
If the supplied function itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally.
Paul.
On 29 Aug 2014, at 16:56, Martin Buchholz <martinrb@google.com> wrote:
Looks fine.
+1 -Chris.
Instead of using Contributed-by: for Doug's work, you should make him the hg "user", as is done in previous changesets. E.g. hg import has a --user flag.
All of jsr166 CVS src/main is ready for sync'ing with openjdk9, i.e. there are no known bugs, even though some future improvements are on the TODO list.
On Fri, Aug 29, 2014 at 3:01 AM, Paul Sandoz <paul.sandoz@oracle.com> wrote:
Hi,
Please review fixes by Doug to j.u.c.CompletableFuture to better control resources for long completion chains (e.g. avoiding stack overflows). This fix resulted in a lot of internal refactoring and clean up. There are also some doc clarifications for certain j.u.c.CompletationStage exception handling methods (which most likely means a CCC is required).
https://bugs.openjdk.java.net/browse/JDK-8056249
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8056249-cf-resource-usage/webre...
--
Is the following snippet missing from the doc updates to the methods CompletationStage.handle and handleAsync?
If the supplied function itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally.
Paul.
On Aug 29, 2014, at 5:56 PM, Martin Buchholz <martinrb@google.com> wrote:
Looks fine.
Thanks Martin & Chris.
Instead of using Contributed-by: for Doug's work, you should make him the hg "user", as is done in previous changesets. E.g. hg import has a --user flag.
Ok, i will do that. Paul.
participants (4)
-
Chris Hegarty
-
Doug Lea
-
Martin Buchholz
-
Paul Sandoz