protected void flushAndClose(Closeable closeable) {
        if (closeable == null) {
            return;
        }
        if (closeable instanceof Flushable) {
            try {
                ((Flushable) closeable).flush();
            } catch (IOException e) {
                LOG.warn(e.getMessage(), e);
            }
        }
        close(closeable);
    }
Use this for structured output that captures resourceId and other attributes.

@param type       entity name for exception
@param resourceId resourceId string
@param t          throwable can be null
@param attrs      (array of key0, value0, key1, value1, etc.)
tika-batch/src/main/java/org/apache/tika/batch/FileResourceConsumer.java