@Test public void testCancelOnNullFuture() { Assert.assertTrue(slFuture.cancel(true)); Assert.assertTrue(slFuture.cancel(false)); }
@Override public synchronized boolean cancel(boolean b) { boolean result = future == null ? (canceled = true) : future.cancel(b); if (future == null) { for (ListenerTuple listenerTuple : listeners) { listenerTuple.execute(); } } return result; }
SettableListenableFuture implements ListenableFuture<T> { @Override public synchronized boolean cancel(boolean b) { boolean result = future == null ? (canceled = true) : future.cancel(b); if (future == null) { for (ListenerTuple listenerTuple : listeners) { listenerTuple.execute(); } } return result; } }
SettableListenableFuture implements ListenableFuture<T> { @Override public synchronized boolean cancel(boolean b) { boolean result = future == null ? (canceled = true) : future.cancel(b); if (future == null) { for (ListenerTuple listenerTuple : listeners) { listenerTuple.execute(); } } return result; } SettableListenableFuture(Callable<T> task, ListeningExecutorService executor); }
SettableListenableFuture implements ListenableFuture<T> { @Override public synchronized boolean cancel(boolean b) { boolean result = future == null ? (canceled = true) : future.cancel(b); if (future == null) { for (ListenerTuple listenerTuple : listeners) { listenerTuple.execute(); } } return result; } SettableListenableFuture(Callable<T> task, ListeningExecutorService executor); @Override synchronized void addListener(Runnable listener, Executor executor); @Override synchronized boolean cancel(boolean b); @Override synchronized boolean isCancelled(); @Override synchronized boolean isDone(); @Override synchronized T get(); @Override synchronized T get(long l, TimeUnit timeUnit); synchronized Callable<T> getTask(); synchronized ListeningExecutorService getExecutor(); synchronized ListenableFuture<T> setFuture(ListenableFuture<T> listenableFuture); }
SettableListenableFuture implements ListenableFuture<T> { @Override public synchronized boolean cancel(boolean b) { boolean result = future == null ? (canceled = true) : future.cancel(b); if (future == null) { for (ListenerTuple listenerTuple : listeners) { listenerTuple.execute(); } } return result; } SettableListenableFuture(Callable<T> task, ListeningExecutorService executor); @Override synchronized void addListener(Runnable listener, Executor executor); @Override synchronized boolean cancel(boolean b); @Override synchronized boolean isCancelled(); @Override synchronized boolean isDone(); @Override synchronized T get(); @Override synchronized T get(long l, TimeUnit timeUnit); synchronized Callable<T> getTask(); synchronized ListeningExecutorService getExecutor(); synchronized ListenableFuture<T> setFuture(ListenableFuture<T> listenableFuture);  }