@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
It collects all service properties (properties having the
#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()
This method returns an empty array (size 0)
getServiceDependencies in interface Servicepublic void serverStatusChange(Server.Status oldStatus, Server.Status newStatus) throws ServiceException
This method returns an empty array (size 0)
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()
The sevice configuration properties are all properties
with names starting with #SERVER#.#SERVICE#.
in the server configuration.
#SERVER#.#SERVICE#.
prefix.protected abstract void init()
throws ServiceException
This method is called by init(Server) after all service properties
(properties prefixed with
ServiceException - thrown if the service could not be initialized.Copyright © 2008–2022 Apache Software Foundation. All rights reserved.