private void setEndedState(STATE cause) {
        synchronized (lock) {
            if (currentState == STATE.NOT_YET_STARTED || currentState == STATE.ACTIVELY_CONSUMING || currentState == STATE.ASKED_TO_SHUTDOWN) {
                currentState = cause;
            }
        }
    }
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