code: private boolean readyToRestore(T object, boolean valid) {
          try {
              boolean ready = false;
              try {
                  ready = valid && poolObjectFactory.readyToRestore(object);
              } finally {
                  if (!ready) {
                      poolObjectFactory.destroy(object);
                  }
              }
              if (!ready) {
                  createdTotal.decrementAndGet();
              }
  
              return ready;
          } catch (RuntimeException | Error e) {
              recoverInnerState();
              throw e;
          }
      }
docs: Verifies whether the given object is valid and whether it can be restored back to the pool. Returns {@code true}
  if the object is valid; otherwise returns {@code false}.
  
  @param object the object that is to be restored to the pool and that needs to be validated
  @param valid if {@code false}, the object is treated as invalid; otherwise a secondary validation on the object
  will be performed
  @return see above