dnrajugade / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

addCallback to Future with timeout #1146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://stackoverflow.com/questions/12380726/listenablefuture-futurecallback-and-
timeouts/12396653#12396653

I was looking for a solution to solve an issue where I want to put a callback 
on a future but also want to impose a timeout on the future. The optimal 
solution would be to have the timeoutexception fire through the onFailure 
callback.

The SO question has a lot more context and a great answer from Chris Povirk. I 
think it'd be pretty useful.

Original issue reported on code.google.com by n...@doapps.com on 13 Sep 2012 at 2:43

GoogleCodeExporter commented 9 years ago
At SO, I called this "addCallback(ListenableFuture, FutureCallback, long, 
TimeUnit, SchededuledExecutorService)."  It's a bit of a mouthful, but it's 
worth considering.  To find potential users, I just reviewed the ~30 internal 
users of addCallback who also use TimeUnit somewhere in their code.  None of 
them are implementing this themselves as I thought they might be.  Still, it's 
possible that some of them (or some of the other callers) *should* be using 
something like this.

Original comment by cpov...@google.com on 13 Sep 2012 at 4:17

GoogleCodeExporter commented 9 years ago
Count me as a +1 for this feature. Because it's not supported, I am (sadly) 
falling back to the old way of submitting the future and calling get(with a 
time out) approach, which I wish I could avoid in favor of ListenableFuture.

Thanks for considering it!

-- 
Cédric

Original comment by cbe...@gmail.com on 30 Sep 2012 at 1:56

GoogleCodeExporter commented 9 years ago
I also need to do something like that. Please count me as a +1!

Original comment by amojo...@gmail.com on 1 Mar 2013 at 2:59

GoogleCodeExporter commented 9 years ago
Ditto on the +1

Original comment by blackduc...@gmail.com on 4 Mar 2013 at 7:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by kak@google.com on 22 Aug 2013 at 10:16

GoogleCodeExporter commented 9 years ago
I actually need to combine this feature with successfulAsList() so that only 
successful and timely futures are in the resulted list.

Original comment by pouyou...@gmail.com on 16 Jan 2014 at 5:00

GoogleCodeExporter commented 9 years ago
Would like the feature as well, need timeout to be set. +1

Original comment by dennis...@gmail.com on 29 Jan 2014 at 5:03

GoogleCodeExporter commented 9 years ago
We had to implement this behavior ourselves now, so +1 for having this in guava

Original comment by anr...@gmail.com on 5 Feb 2014 at 11:13

GoogleCodeExporter commented 9 years ago
Also had a requirement for this; it would be great to see this in Guava.

Original comment by andrewba...@gmail.com on 20 Apr 2014 at 12:24

GoogleCodeExporter commented 9 years ago
+1 for this feature, we are still to implement a solution for this.

Original comment by miss.mig...@gmail.com on 25 Apr 2014 at 1:29

GoogleCodeExporter commented 9 years ago
+1 Currently using a Future to work around this.

Original comment by jens.ran...@tink.se on 23 Jun 2014 at 2:42

GoogleCodeExporter commented 9 years ago
Waiting for a better solution from Guaua library, we are heavily relying on 
workarounds.

Original comment by karthik....@gmail.com on 12 Aug 2014 at 8:15

GoogleCodeExporter commented 9 years ago
due to this missing feature i switched to javarx and Observables

Original comment by gentilip...@gmail.com on 10 Sep 2014 at 4:06

GoogleCodeExporter commented 9 years ago
Any updates on this?

Original comment by magnus....@gmail.com on 30 Sep 2014 at 7:55

GoogleCodeExporter commented 9 years ago
The makeTimeoutFuture method described at the StackOverflow link has gotten 
some traction inside Google. We should probably add it to Guava.

Original comment by cpov...@google.com on 30 Sep 2014 at 2:28

GoogleCodeExporter commented 9 years ago
+1 for this feature. Any update on when this will be available?

Original comment by deepan.m...@gmail.com on 22 Oct 2014 at 1:38

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08