@Test public void respond() { AtomicBoolean success = new AtomicBoolean(false); AtomicBoolean failure = new AtomicBoolean(false); final Responder<Integer> r = new Responder<Integer>() { @Override public void onException(Throwable ex) { failure.set(true); } @Override public void onValue(Integer value) { success.set(true); } }; Future.<Integer>exception(ex).respond(r); assertFalse(success.get()); assertTrue(failure.get()); }
@Override public final Future<T> respond(final Responder<? super T> r) { try { r.onException(ex); } catch (final Throwable error) { logger.log(Level.WARNING, "Error executing `respond` callback " + r + "for" + this, ex); NonFatalException.verify(error); } return this; }
ExceptionFuture implements SatisfiedFuture<T> { @Override public final Future<T> respond(final Responder<? super T> r) { try { r.onException(ex); } catch (final Throwable error) { logger.log(Level.WARNING, "Error executing `respond` callback " + r + "for" + this, ex); NonFatalException.verify(error); } return this; } }
ExceptionFuture implements SatisfiedFuture<T> { @Override public final Future<T> respond(final Responder<? super T> r) { try { r.onException(ex); } catch (final Throwable error) { logger.log(Level.WARNING, "Error executing `respond` callback " + r + "for" + this, ex); NonFatalException.verify(error); } return this; } protected  ExceptionFuture(final Throwable ex); }
ExceptionFuture implements SatisfiedFuture<T> { @Override public final Future<T> respond(final Responder<? super T> r) { try { r.onException(ex); } catch (final Throwable error) { logger.log(Level.WARNING, "Error executing `respond` callback " + r + "for" + this, ex); NonFatalException.verify(error); } return this; } protected  ExceptionFuture(final Throwable ex); @Override final Future<R> map(final Function<? super T, ? extends R> f); @Override final Future<R> flatMap(final Function<? super T, ? extends Future<R>> f); @Override Future<R> transform(final Transformer<? super T, ? extends R> t); @Override Future<R> transformWith(final Transformer<? super T, ? extends Future<R>> t); @Override Future<R> biMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends R> f); @Override Future<R> biFlatMap(final Future<U> other,
      final BiFunction<? super T, ? super U, ? extends Future<R>> f); @Override final Future<T> onSuccess(final Consumer<? super T> c); @Override final Future<T> onFailure(final Consumer<Throwable> c); @Override final Future<T> respond(final Responder<? super T> r); @Override final Future<T> rescue(final Function<Throwable, ? extends Future<T>> f); @Override final Future<Void> voided(); @Override final T get(final Duration timeout); @Override final String toString(); @Override final int hashCode(); @Override final boolean equals(final Object obj); }
ExceptionFuture implements SatisfiedFuture<T> { @Override public final Future<T> respond(final Responder<? super T> r) { try { r.onException(ex); } catch (final Throwable error) { logger.log(Level.WARNING, "Error executing `respond` callback " + r + "for" + this, ex); NonFatalException.verify(error); } return this; } protected  ExceptionFuture(final Throwable ex); @Override final Future<R> map(final Function<? super T, ? extends R> f); @Override final Future<R> flatMap(final Function<? super T, ? extends Future<R>> f); @Override Future<R> transform(final Transformer<? super T, ? extends R> t); @Override Future<R> transformWith(final Transformer<? super T, ? extends Future<R>> t); @Override Future<R> biMap(final Future<U> other, final BiFunction<? super T, ? super U, ? extends R> f); @Override Future<R> biFlatMap(final Future<U> other,
      final BiFunction<? super T, ? super U, ? extends Future<R>> f); @Override final Future<T> onSuccess(final Consumer<? super T> c); @Override final Future<T> onFailure(final Consumer<Throwable> c); @Override final Future<T> respond(final Responder<? super T> r); @Override final Future<T> rescue(final Function<Throwable, ? extends Future<T>> f); @Override final Future<Void> voided(); @Override final T get(final Duration timeout); @Override final String toString(); @Override final int hashCode(); @Override final boolean equals(final Object obj);  }