Package org.apache.hadoop.service
Class ServiceOperations
java.lang.Object
org.apache.hadoop.service.ServiceOperations
This class contains a set of methods to work with services, especially
to walk them through their lifecycle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classorg.apache.hadoop.service.ServiceOperations.ServiceListenersClass to manage a list ofServiceStateChangeListenerinstances, including a notification loop that is robust against changes to the list during the notification process. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidStop a service.static ExceptionstopQuietly(org.apache.commons.logging.Log log, Service service) Deprecated.to be removed with 3.4.0.static ExceptionstopQuietly(Service service) Stop a service; if it is null do nothing.static ExceptionstopQuietly(org.slf4j.Logger log, Service service) Stop a service; if it is null do nothing.
-
Method Details
-
stop
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
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. UsestopQuietly(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 atservice- a service; may be null- Returns:
- any exception that was caught; null if none was.
-
stopQuietly
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 atservice- a service; may be null- Returns:
- any exception that was caught; null if none was.
- See Also:
-