@Override
        public boolean isValidTransition(final ThreadStateTransitionValidator newState) {
            final State tmpState = (State) newState;
            return validTransitions.contains(tmpState.ordinal());
        }
The states that the global stream thread can be in

<pre>
               +-------------+
         +<--- | Created (0) |
         |     +-----+-------+
         |           |
         |           v
         |     +-----+-------+
         +<--- | Running (1) |
         |     +-----+-------+
         |           |
         |           v
         |     +-----+-------+
         +---> | Pending     |
               | Shutdown (2)|
               +-----+-------+
                     |
                     v
               +-----+-------+
               | Dead (3)    |
               +-------------+
</pre>

Note the following:
<ul>
    <li>Any state can go to PENDING_SHUTDOWN. That is because streams can be closed at any time.</li>
    <li>State PENDING_SHUTDOWN may want to transit itself. In this case we will forbid the transition but will not treat as an error.</li>
</ul>
streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java