Applies the provided supplier and flattens the result. This method is useful to apply a supplier safely without having to catch possible synchronous exceptions that the supplier may throw. @param s a supplier that may throw an exception @return the future produced by the supplier or a failed f
(final Supplier<Future<T>> s)
| 151 | * throws a synchronous exception (not a failed Future) |
| 152 | */ |
| 153 | public static <T> Future<T> flatApply(final Supplier<Future<T>> s) { |
| 154 | try { |
| 155 | return s.get(); |
| 156 | } catch (final Throwable ex) { |
no outgoing calls