Closed GoogleCodeExporter closed 9 years ago
We might add a Future that automatically completes after a delay. The most
likely implementation would be with a ScheduledExecutorService. With the
proposed implementation, a listener that calls Future.get() (as many do) would
block for 5 seconds (or however long). This would distort the performance
measurements that you're attempting to make. Similar distortions would arise
from multiple calls to get(), each of which would block anew.
Original comment by cpov...@google.com
on 14 Mar 2014 at 1:58
isn't this a simple matter of:
ListeningScheduledExecutorService service = ...;
public <T> ListenableFuture<T> delayed(T v, long t, TimeUnit u) {
return service.schedule(Callables.returning(v), t, u);
}
Original comment by lu...@google.com
on 14 Mar 2014 at 3:20
Thanks for the code snippet with the scheduled service, it is as simple as that
indeed.
Original comment by wim.debl...@gmail.com
on 18 Mar 2014 at 8:00
Excellent. Thanks, Luke.
Original comment by cpov...@google.com
on 18 Mar 2014 at 1:31
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:09
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:07
Original issue reported on code.google.com by
wim.debl...@gmail.com
on 14 Mar 2014 at 9:06