Code example for Future

Methods: getisCancelledisDone

0
  protected void doStart() { _future = _futureThunk.value(); started(); }
  protected void doStop() { _future.cancel(true); }
  protected void discard() { _futureThunk = null; _future = null; }
   
  protected void update() { 
    if (_future.isDone()) {
      if (_future.isCancelled()) { stopped(); }
      else { 
        try { finish(); } 
        catch (InterruptedException e) {  }
      } 
    } 
  } 
   
  protected void finish() throws InterruptedException { 
    try { finishedCleanly(_future.get()); }
    catch (CancellationException e) { stopped(); }
    catch (ExecutionException e) { handleExecutionException(e); }
    catch (RuntimeException e) { finishedWithImplementationException(e); }
  } 
   
Experience pair programming with AI  Get Codota for Java