private void attemptToCancel(Future<?> future) {
    LOG.debug("Task {} timeout exceeded, cancelling", taskName);
    if (!future.isDone() && future.cancel(true)) {
      LOG.debug("Task {} cancelled", taskName);
    } else {
      LOG.debug("Task {} already done", taskName);
    }
  }
Callable service implementation for executing tasks asynchronously.
The service repeatedly tries to execute the provided task till it successfully completes, or the provided timeout
interval is exceeded.

@param <T> the type returned by the task to be executed
ambari-server/src/main/java/org/apache/ambari/server/topology/AsyncCallableService.java