org.apache.hadoop.yarn.server.api
Class AuxiliaryService

java.lang.Object
  extended by org.apache.hadoop.service.AbstractService
      extended by org.apache.hadoop.yarn.server.api.AuxiliaryService
All Implemented Interfaces:
Closeable, org.apache.hadoop.service.Service

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class AuxiliaryService
extends org.apache.hadoop.service.AbstractService

A generic service that will be started by the NodeManager. This is a service that administrators have to configure on each node by setting YarnConfiguration.NM_AUX_SERVICES.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE
 
Constructor Summary
protected AuxiliaryService(String name)
           
 
Method Summary
abstract  ByteBuffer getMetaData()
          Retrieve meta-data for this AuxiliaryService.
 ByteBuffer getMetaData(ContainerInitializationContext initContainerContext)
          Return Metadata based on the context provided if not overwrite is provided returns service MetaData
abstract  void initializeApplication(ApplicationInitializationContext initAppContext)
          A new application is started on this NodeManager.
 void initializeContainer(ContainerInitializationContext initContainerContext)
          A new container is started on this NodeManager.
abstract  void stopApplication(ApplicationTerminationContext stopAppContext)
          An application is finishing on this NodeManager.
 void stopContainer(ContainerTerminationContext stopContainerContext)
          A container is finishing on this NodeManager.
 
Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuxiliaryService

protected AuxiliaryService(String name)
Method Detail

initializeApplication

public abstract void initializeApplication(ApplicationInitializationContext initAppContext)
A new application is started on this NodeManager. This is a signal to this AuxiliaryService about the application initialization.

Parameters:
initAppContext - context for the application's initialization

stopApplication

public abstract void stopApplication(ApplicationTerminationContext stopAppContext)
An application is finishing on this NodeManager. This is a signal to this AuxiliaryService about the same.

Parameters:
stopAppContext - context for the application termination

getMetaData

public abstract ByteBuffer getMetaData()
Retrieve meta-data for this AuxiliaryService. Applications using this AuxiliaryService SHOULD know the format of the meta-data - ideally each service should provide a method to parse out the information to the applications. One example of meta-data is contact information so that applications can access the service remotely. This will only be called after the service's AbstractService.start() method has finished. the result may be cached.

The information is passed along to applications via StartContainersResponse.getAllServicesMetaData() that is returned by ContainerManagementProtocol.startContainers(StartContainersRequest)

Returns:
meta-data for this service that should be made available to applications.

initializeContainer

public void initializeContainer(ContainerInitializationContext initContainerContext)
A new container is started on this NodeManager. This is a signal to this AuxiliaryService about the container initialization. This method is called when the NodeManager receives the container launch command from the ApplicationMaster and before the container process is launched.

Parameters:
initContainerContext - context for the container's initialization

getMetaData

public ByteBuffer getMetaData(ContainerInitializationContext initContainerContext)
Return Metadata based on the context provided if not overwrite is provided returns service MetaData

Parameters:
initContainerContext -
Returns:
metadata

stopContainer

public void stopContainer(ContainerTerminationContext stopContainerContext)
A container is finishing on this NodeManager. This is a signal to this AuxiliaryService about the same.

Parameters:
stopContainerContext - context for the container termination


Copyright © 2014 Apache Software Foundation. All Rights Reserved.