public synchronized void ensureClosed() throws IOException, IllegalStateException {
    if (storage == null || isClosedPredicate.test(storage)) {
      return;
    }

    String message = "Storage " + storageName + " is not closed yet";
    if (failIfNotClosed) {
      throw new IllegalStateException(message);
    }

    LOG.warn(message);

    //TODO RC: if we don't throw exception -- we should close storage here, otherwise this is not logically-consistent
    //         behavior
    if (CLOSE_BEFORE_REOPEN) {
      storage.close();
    }
  }
public synchronized void ensureClosed()