Creates a future with the result of the supplier. Note that the supplier is executed by the current thread. Use FuturePool.async to execute the supplier on a separate thread. @param s a supplier that may throw an exception @param the type of the value returned by the Supplier. @return a
(final Supplier<T> s)
| 134 | * the supplier exception. |
| 135 | */ |
| 136 | public static <T> Future<T> apply(final Supplier<T> s) { |
| 137 | try { |
| 138 | return new ValueFuture<>(s.get()); |
| 139 | } catch (final Throwable ex) { |
no outgoing calls