in src/main/java/com/amazonaws/services/sqs/executors/ExecutorUtils.java [40:58]
public static <T> T getOn(ExecutorService executor, SerializableSupplier<T> supplier) {
Future<T> future = executor.submit(SerializableCallable.serializable(supplier::get));
for (;;) {
try {
// managedBlock will check this anyway, but it saves the extra object construction
// when not running in a pool.
if (ForkJoinTask.inForkJoinPool()) {
ForkJoinPool.managedBlock(new FutureGetter<>(future));
}
return future.get();
} catch (ExecutionException e) {
// Accepting only Suppliers rather than Callables ensures that
// only RuntimeExceptions are expected here.
throw (RuntimeException)e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}