org.apache.hive.service
Class ServiceOperations

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

public final class ServiceOperations
extends Object

ServiceOperations.


Method Summary
static void deploy(Service service, HiveConf configuration)
          Initialize then start a service.
static void ensureCurrentState(Service.STATE state, Service.STATE expectedState)
          Verify that that a service is in a given state.
static void init(Service service, HiveConf configuration)
          Initialize a service.
static void start(Service service)
          Start a service.
static void stop(Service service)
          Stop a service.
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

ensureCurrentState

public static void ensureCurrentState(Service.STATE state,
                                      Service.STATE expectedState)
Verify that that a service is in a given state.

Parameters:
state - the actual state a service is in
expectedState - the desired state
Throws:
IllegalStateException - if the service state is different from the desired state

init

public static void init(Service service,
                        HiveConf configuration)
Initialize a service.

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

Parameters:
service - a service that must be in the state Service.STATE.NOTINITED
configuration - the configuration to initialize the service with
Throws:
RuntimeException - on a state change failure
IllegalStateException - if the service is in the wrong state

start

public static void start(Service service)
Start a service.

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

Parameters:
service - a service that must be in the state Service.STATE.INITED
Throws:
RuntimeException - on a state change failure
IllegalStateException - if the service is in the wrong state

deploy

public static void deploy(Service service,
                          HiveConf configuration)
Initialize then start a service.

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

Parameters:
service - a service that must be in the state Service.STATE.NOTINITED
configuration - the configuration to initialize the service with
Throws:
RuntimeException - on a state change failure
IllegalStateException - if the service is in the wrong state

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.


Copyright © 2013 The Apache Software Foundation