Esempio n. 1
0
 /**
  * Creates a new promise that is already resolved with the given error.
  *
  * @param error the error for the new promise
  * @param <T> the type of the value for the promise
  * @return the promise
  */
 public static <T> Promise<T> error(final Throwable error) {
   final SettablePromise<T> promise = settable();
   promise.fail(error);
   return promise;
 }
Esempio n. 2
0
 /**
  * Creates a new promise that is already resolved with the given value.
  *
  * @param value the value for the new promise
  * @param <T> the type of the value for the promise
  * @return the promise
  */
 public static <T> Promise<T> value(final T value) {
   final SettablePromise<T> promise = settable();
   promise.done(value);
   return promise;
 }