/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object. * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object. * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object. * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object. * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }
/** * Returns a new Promise that will hold the result of the specified task. * <p> * The returned Promise uses the callback executor and scheduled executor of * this PromiseFactory object. * <p> * The specified task will be executed on the {@link #executor() callback * executor}. * * @param <T> The value type associated with the returned Promise. * @param task The task whose result will be available from the returned * Promise. * @return A new Promise that will hold the result of the specified task. */ public <T> Promise<T> submit(Callable< ? extends T> task) { DeferredPromiseImpl<T> promise = new DeferredPromiseImpl<>(this); Runnable submit = promise.new Submit(task); try { executor().execute(submit); } catch (Exception t) { promise.tryResolve(null, t); } return promise.orDone(); }