public void close()

in src/main/java/net/hydromatic/linq4j/Linq4j.java [429:467]


    public void close() {
      final Iterator<T> iterator = this.iterator;
      this.iterator = null;
      if (AUTO_CLOSEABLE_CLOSE_METHOD != null) {
        // JDK 1.7 or later
        if (AUTO_CLOSEABLE_CLOSE_METHOD.getDeclaringClass()
            .isInstance(iterator)) {
          try {
            AUTO_CLOSEABLE_CLOSE_METHOD.invoke(iterator);
          } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
          } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getCause());
          }
        }
      } else {
        // JDK 1.5 or 1.6. No AutoCloseable. Cover the two most common cases
        // with a close().
        if (iterator instanceof Closeable) {
          try {
            ((Closeable) iterator).close();
            return;
          } catch (RuntimeException e) {
            throw e;
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        if (iterator instanceof ResultSet) {
          try {
            ((ResultSet) iterator).close();
          } catch (RuntimeException e) {
            throw e;
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
      }
    }