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 ) ; } }
Checks whether the resource is healthy . If not retry . When this called the resource is not in mAvailableResources .