public boolean isRunning() {
        synchronized (stateLock) {
            return state.isAlive();
        }
    }
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