org.apache.hadoop.service
Class ServiceOperations

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

@InterfaceAudience.Public
@InterfaceStability.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 Summary
static void stop(Service service)
          Stop a service.
static Exception stopQuietly(org.apache.commons.logging.Log log, Service service)
          Stop a service; if it is null do nothing.
static Exception stopQuietly(Service service)
          Stop a service; if it is null do nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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

public static Exception stopQuietly(org.apache.commons.logging.Log 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:
stopQuietly(Service)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.