@Test public void testFutureGetTimeout() throws ExecutionException, InterruptedException { final OnCompleteFuture<Long> future = new OnCompleteFuture<>(); try { future.get(1000, TimeUnit.MILLISECONDS); fail("Did Not Timeout"); } catch (TimeoutException e) { System.out.println("TimedOut: Good."); } }
@Override public V get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { return null; } }
OnCompleteFuture implements Future<V> { @Override public V get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { return null; } } }
OnCompleteFuture implements Future<V> { @Override public V get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { return null; } }  }
OnCompleteFuture implements Future<V> { @Override public V get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { return null; } }  void setOnComplete(OnComplete<V> onComplete); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); void setValue(V value); @Override V get(); @Override V get(long timeout, TimeUnit unit); void reset(); }
OnCompleteFuture implements Future<V> { @Override public V get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { return null; } }  void setOnComplete(OnComplete<V> onComplete); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); void setValue(V value); @Override V get(); @Override V get(long timeout, TimeUnit unit); void reset();  }