Returns the result of calling Future#get() interruptibly on a task known not to throw a checked exception. If interrupted, the interrupt is restored before throwing an exception.. @throws java.util.concurrent.CancellationException if get throws a {@code CancellationException
(Future<V> future)
| 337 | * or an {@link InterruptedException}. |
| 338 | */ |
| 339 | private static <V> V getUnchecked(Future<V> future) { |
| 340 | try { |
| 341 | return future.get(); |
| 342 | } catch (InterruptedException e) { |
| 343 | Thread.currentThread().interrupt(); |
| 344 | throw Status.CANCELLED |
| 345 | .withDescription("Thread interrupted") |
| 346 | .withCause(e) |
| 347 | .asRuntimeException(); |
| 348 | } catch (ExecutionException e) { |
| 349 | throw toStatusRuntimeException(e.getCause()); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Wraps the given {@link Throwable} in a {@link StatusRuntimeException}. If it contains an |