Code example for Future

Methods: cancel, get

0
  } 
 
  @Override 
  public Void call() throws ExecutionException, InterruptedException {
    try { 
      future.get(timeout, unit);
    } catch (TimeoutException te) {
      future.cancel(true);
    } 
    return null; 
  } 
 
}