-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Settle on an interface for Futures.allAsList/successfulAsList (and Google-internal allAsMap/successfulAsMap) #1519
Comments
Original comment posted by [email protected] on 2014-08-13 at 01:49 PM An internal user would like to be able to access the result as a Future<ImmutableList<V>> rather than a Future<PlainListThatHappensToBeImpossibleToMutate<V>>. He's using a framework that requires known immutable objects. He can transform(), of course, but if we make change (2), this would be an opportunity to switch to ImmutableList (at the cost of some verbosity to users who don't care). An additional feature to consider is some kind of configuration of logging (or, more generally, of handling of failures). Our current policy can be a bit spammy, but we would fear dropping important messages if we turned logging off universally. This still doesn't make the API clear. Future<ImmutableList<Foo>> f = Futures.collect(list).allMustSucceed(), etc.? There are many options. |
We introduced |
Hacky workaround: Ensure that every failure exception thrown is |
We can't store a plain V because we need to distinguish between Optional.absent() and null (at least in the Google-internal successfulAsMap -- and eventually in whenAllComplete(...).collectToList() (#1519), which is likely to omit failures instead of mapping them to null as successfulAsList does). We may have problems using Optional when we adopt new nullability annotations, since Optional<V> might not be a valid instantiation when V is instantiated with a nullable type. RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=298398456
We can't store a plain V because we need to distinguish between Optional.absent() and null (at least in the Google-internal successfulAsMap -- and eventually in whenAllComplete(...).collectToList() (#1519), which is likely to omit failures instead of mapping them to null as successfulAsList does). We may have problems using Optional when we adopt new nullability annotations, since Optional<V> might not be a valid instantiation when V is instantiated with a nullable type. RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=298398456
See also "SEVERE: input future failed" spams stdout/stderr (#2134), in which I propose a possible workaround for people with that problem. |
This is now fixed. |
(Oops, I forgot about the logging business. Still, I'm not sure that the I'm going to reopen this issue to track the theoretical possibility that we'd (a) introduce a better API for this ( |
Original issue created by [email protected] on 2013-08-29 at 09:11 PM
[edit: see also #3394 about a
Collector
-based equivalent]The text was updated successfully, but these errors were encountered: