Class ServiceOperations

java.lang.Object
org.apache.hadoop.service.ServiceOperations

@Public @Evolving public final class ServiceOperations extends Object
This class contains a set of methods to work with services, especially to walk them through their lifecycle.
  • Method Details

    • stop

      public static void stop(Service service)
      Stop a service.

      Do nothing if the service is null or not in a state in which it can be/needs to be stopped.

      The service state is checked before the operation begins. This process is not thread safe.

      Parameters:
      service - a service or null
    • stopQuietly

      public static Exception stopQuietly(Service service)
      Stop a service; if it is null do nothing. Exceptions are caught and logged at warn level. (but not Throwables). This operation is intended to be used in cleanup operations
      Parameters:
      service - a service; may be null
      Returns:
      any exception that was caught; null if none was.
    • stopQuietly

      @Deprecated public static Exception stopQuietly(org.apache.commons.logging.Log log, Service service)
      Deprecated.
      to be removed with 3.4.0. Use stopQuietly(Logger, Service) instead.
      Stop a service; if it is null do nothing. Exceptions are caught and logged at warn level. (but not Throwables). This operation is intended to be used in cleanup operations
      Parameters:
      log - the log to warn at
      service - a service; may be null
      Returns:
      any exception that was caught; null if none was.
    • stopQuietly

      public static Exception stopQuietly(org.slf4j.Logger log, Service service)
      Stop a service; if it is null do nothing. Exceptions are caught and logged at warn level. (but not Throwables). This operation is intended to be used in cleanup operations
      Parameters:
      log - the log to warn at
      service - a service; may be null
      Returns:
      any exception that was caught; null if none was.
      See Also: