@InterfaceAudience.Private public abstract class BaseService extends Object implements Service
Service interface.| Constructor and Description |
|---|
BaseService(String prefix)
Service constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the services.
|
protected String |
getPrefix()
Returns the service prefix.
|
protected String |
getPrefixedName(String name)
Returns the full prefixed name of a service property.
|
protected Server |
getServer()
Returns the server owning the service.
|
protected org.apache.hadoop.conf.Configuration |
getServiceConfig()
Returns the service configuration properties.
|
Class[] |
getServiceDependencies()
Returns the service dependencies of this service.
|
protected abstract void |
init()
Initializes the server.
|
void |
init(Server server)
Initializes the service.
|
void |
postInit()
Post initializes the service.
|
void |
serverStatusChange(Server.Status oldStatus,
Server.Status newStatus)
Notification callback when the server changes its status.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInterfacepublic BaseService(String prefix)
prefix - service prefix.public final void init(Server server) throws ServiceException
#SERVER#.#SERVICE#. prefix). The property names are then
trimmed from the #SERVER#.#SERVICE#. prefix.
After collecting the service properties it delegates to the
init() method.init in interface Serviceserver - the server initializing the service, give access to the
server context.ServiceException - thrown if the service could not be initialized.public void postInit()
throws ServiceException
Server after all services of the server have been initialized.
This method does a NOP.postInit in interface ServiceServiceException - thrown if the service could not be
post-initialized.public void destroy()
Server owning the service is being destroyed.
This method does a NOP.public Class[] getServiceDependencies()
getServiceDependencies in interface Servicepublic void serverStatusChange(Server.Status oldStatus, Server.Status newStatus) throws ServiceException
serverStatusChange in interface ServiceoldStatus - old server status.newStatus - new server status.ServiceException - thrown if the service could not process the status change.protected String getPrefix()
protected Server getServer()
protected String getPrefixedName(String name)
name - of the property.protected org.apache.hadoop.conf.Configuration getServiceConfig()
#SERVER#.#SERVICE#.
in the server configuration.#SERVER#.#SERVICE#.
prefix.protected abstract void init()
throws ServiceException
init(Server) after all service properties
(properties prefixed withServiceException - thrown if the service could not be initialized.Copyright © 2016 Apache Software Foundation. All Rights Reserved.