Future.resultNow / exceptionNow

Alan Bateman Alan.Bateman at oracle.com
Sat Nov 20 17:32:24 UTC 2021



On 20/11/2021 16:51, Remi Forax wrote:
> :
> Hi Alex, the idea of resultNow()/exceptionNow() is that it should be called when you have the guarantee that isDone is true,
> like after a call to StructuredExecutor.join()/joinUntil().
>
> So it should throw a ISE because it means that you have not use resultNow()/exceptionNow() correctly, by example because you have forgotten to do call StructuredExecutor.join() first.
Also just to say that it makes it easy to have Futures be elements in 
streams: filter on the state, map with resultNow. Also works nicely with 
switch.

-Alan


More information about the loom-dev mailing list