protected final void returnResource(T resource){
  Preconditions.checkNotNull(resource);
  try {
    cleanupForReturnToPool(resource);
  }
 catch (  RuntimeException e) {
    log.error("should not throw here",e);
  }
  boolean wasReturned=returnToQueue(resource);
  if (!wasReturned) {
    log.info("Pool full, releasing resource: {}",resource);
    allocatedResources.decrementAndGet();
    try {
      cleanupForDiscard(resource);
    }
 catch (    RuntimeException e) {
      log.error("should not throw here",e);
    }
  }
  logPoolStats();
}

protected final void returnResource ( T resource ) { Preconditions . checkNotNull ( resource ) ; try { cleanupForReturnToPool ( resource ) ; } catch ( RuntimeException e ) { log . error ( "should not throw here" , e ) ; } boolean wasReturned = returnToQueue ( resource ) ; if ( ! wasReturned ) { log . info ( "Pool full, releasing resource: {}" , resource ) ; allocatedResources . decrementAndGet ( ) ; try { cleanupForDiscard ( resource ) ; } catch ( RuntimeException e ) { log . error ( "should not throw here" , e ) ; } } logPoolStats ( ) ; }
this method should only be called in the finally block of a try / finally
