org.apache.hive.service
Class AbstractService

java.lang.Object
  extended by org.apache.hive.service.AbstractService
All Implemented Interfaces:
Service
Direct Known Subclasses:
BreakableService, CompositeService, OperationManager, ThriftCLIService

public abstract class AbstractService
extends Object
implements Service

AbstractService.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hive.service.Service
Service.STATE
 
Constructor Summary
AbstractService(String name)
          Construct the service.
 
Method Summary
 HiveConf getHiveConf()
          Get the configuration of this service.
 String getName()
          Get the name of this service.
 Service.STATE getServiceState()
          Get the current service state
 long getStartTime()
          Get the service start time
 void init(HiveConf hiveConf)
          Initialize the service.
 void register(ServiceStateChangeListener l)
          Register an instance of the service state change events.
 void start()
          Start the service.
 void stop()
          Stop the service.
 void unregister(ServiceStateChangeListener l)
          Unregister a previously instance of the service state change events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractService

public AbstractService(String name)
Construct the service.

Parameters:
name - service name
Method Detail

getServiceState

public Service.STATE getServiceState()
Description copied from interface: Service
Get the current service state

Specified by:
getServiceState in interface Service
Returns:
the state of the service

init

public void init(HiveConf hiveConf)
Initialize the service. The transition must be from Service.STATE.NOTINITED to Service.STATE.INITED unless the operation failed and an exception was raised.

Specified by:
init in interface Service
Throws:
IllegalStateException - if the current service state does not permit this action

start

public void start()
Start the service. The transition should be from Service.STATE.INITED to Service.STATE.STARTED unless the operation failed and an exception was raised.

Specified by:
start in interface Service
Throws:
IllegalStateException - if the current service state does not permit this action

stop

public void stop()
Stop the service. This operation must be designed to complete regardless of the initial state of the service, including the state of all its internal fields.

Specified by:
stop in interface Service
Throws:
IllegalStateException - if the current service state does not permit this action

register

public void register(ServiceStateChangeListener l)
Description copied from interface: Service
Register an instance of the service state change events.

Specified by:
register in interface Service
Parameters:
l - a new listener

unregister

public void unregister(ServiceStateChangeListener l)
Description copied from interface: Service
Unregister a previously instance of the service state change events.

Specified by:
unregister in interface Service
Parameters:
l - the listener to unregister.

getName

public String getName()
Description copied from interface: Service
Get the name of this service.

Specified by:
getName in interface Service
Returns:
the service name

getHiveConf

public HiveConf getHiveConf()
Description copied from interface: Service
Get the configuration of this service. This is normally not a clone and may be manipulated, though there are no guarantees as to what the consequences of such actions may be

Specified by:
getHiveConf in interface Service
Returns:
the current configuration, unless a specific implementation chooses otherwise.

getStartTime

public long getStartTime()
Description copied from interface: Service
Get the service start time

Specified by:
getStartTime in interface Service
Returns:
the start time of the service. This will be zero if the service has not yet been started.


Copyright © 2013 The Apache Software Foundation