code: private T checkHealthyAndRetry(T resource, long endTimeMs) throws TimeoutException, IOException {
      if (isHealthy(resource)) {
        return resource;
      } else {
        LOG.info("Clearing unhealthy resource {}.", resource);
        remove(resource);
        closeResource(resource);
        return acquire(endTimeMs - mClock.millis(), TimeUnit.MILLISECONDS);
      }
    }
docs: Checks whether the resource is healthy. If not retry. When this called, the resource
  is not in mAvailableResources.
  
  @param resource the resource to check
  @param endTimeMs the end time to wait till
  @return the resource
  @throws TimeoutException if it times out to wait for a resource