public boolean isStartingRunningOrPartitionAssigned() {
        synchronized (stateLock) {
            return state.equals(State.RUNNING) || state.equals(State.STARTING) || state.equals(State.PARTITIONS_ASSIGNED);
        }
    }
Sets the state

@param newState New state
@return The state prior to the call to setState, or null if the transition is invalid
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java