public static void stop(Service service) {
    if (service != null) {
      Service.STATE state = service.getServiceState();
      if (state == Service.STATE.STARTED) {
        service.stop();
      }
    }
  }
Stop a service.
<br>Do nothing if the service is null or not
in a state in which it can be/needs to be stopped.
<br>
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service or null
service/src/java/org/apache/hive/service/ServiceOperations.java