STS allows to bypass any checked exceptions
    Alan Bateman 
    Alan.Bateman at oracle.com
       
    Sun May 14 05:24:32 UTC 2023
    
    
  
On 13/05/2023 22:33, Remi Forax wrote:
> :
>
>      static <T> T bypassCheckedException(Callable<? extends T> callable) {
>          try(var sts = new StructuredTaskScope<>()) {
>              var task = sts.fork(callable);
>              try {
>                  sts.join();
>              } catch (InterruptedException e) {
>                  Thread.currentThread().interrupt();
>              }
>              return task.get();
>          }
>      }
>
I think the subject line is a bit misleading :-)
I think you are asking about continuing when join is interrupted (or the 
deadline is reached with joinUntil). Right now, the spec for 
ensureOwnerAndJoined is that ISE is thrown if the owner did not invoke 
join after forking. It doesn't make it clear what this means if join 
doesn't complete successfully. It's different for close, it should throw 
if join as been attempted. There's a more general question when you have 
a sequence of phases that I was mulling over recently. Thanks for 
bringing it up.
-Alan
    
    
More information about the loom-dev
mailing list