public void setState(StreamState newState) {
        StreamState oldState = state.get();
        if (!oldState.equals(newState) && state.compareAndSet(oldState, newState)) {
            fireStateChange(oldState, newState);
        }
    }
public void setState ( StreamState newState ) { StreamState oldState = state . get ( ) ; if ( ! oldState . equals ( newState ) && state . compareAndSet ( oldState , newState ) ) { fireStateChange ( oldState , newState ) ; } }
Sets the stream state.

@param newState stream state