@Test public void testCompleted() throws Exception { final ComplexFuture<Object> future = new ComplexFuture<>(null); final Future<Object> dependency1 = new BasicFuture<>(null); future.setDependency(dependency1); Assert.assertFalse(future.isDone()); future.completed(Boolean.TRUE); Assert.assertThat(future.isCancelled(), CoreMatchers.is(false)); Assert.assertThat(dependency1.isCancelled(), CoreMatchers.is(false)); final Future<Object> dependency2 = new BasicFuture<>(null); future.setDependency(dependency2); Assert.assertThat(dependency2.isCancelled(), CoreMatchers.is(true)); }
@Override public boolean completed(final T result) { final boolean completed = super.completed(result); dependencyRef.set(null); return completed; }
ComplexFuture extends BasicFuture<T> implements CancellableDependency { @Override public boolean completed(final T result) { final boolean completed = super.completed(result); dependencyRef.set(null); return completed; } }
ComplexFuture extends BasicFuture<T> implements CancellableDependency { @Override public boolean completed(final T result) { final boolean completed = super.completed(result); dependencyRef.set(null); return completed; } ComplexFuture(final FutureCallback<T> callback); }
ComplexFuture extends BasicFuture<T> implements CancellableDependency { @Override public boolean completed(final T result) { final boolean completed = super.completed(result); dependencyRef.set(null); return completed; } ComplexFuture(final FutureCallback<T> callback); @Override void setDependency(final Cancellable dependency); void setDependency(final Future<?> dependency); @Override boolean completed(final T result); @Override boolean failed(final Exception exception); @Override boolean cancel(final boolean mayInterruptIfRunning); }
ComplexFuture extends BasicFuture<T> implements CancellableDependency { @Override public boolean completed(final T result) { final boolean completed = super.completed(result); dependencyRef.set(null); return completed; } ComplexFuture(final FutureCallback<T> callback); @Override void setDependency(final Cancellable dependency); void setDependency(final Future<?> dependency); @Override boolean completed(final T result); @Override boolean failed(final Exception exception); @Override boolean cancel(final boolean mayInterruptIfRunning);  }