public static void ensureCurrentState(Service.STATE state,
                                        Service.STATE expectedState) {
    if (state != expectedState) {
      throw new IllegalStateException("For this operation, the " +
                                          "current service state must be "
                                          + expectedState
                                          + " instead of " + state);
    }
  }
Verify that that a service is in a given state.
@param state the actual state a service is in
@param expectedState the desired state
@throws IllegalStateException if the service state is different from
the desired state
service/src/java/org/apache/hive/service/ServiceOperations.java