Interface RequestInterceptor

All Superinterfaces:
org.apache.hadoop.yarn.api.ApplicationMasterProtocol, org.apache.hadoop.conf.Configurable, org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol
All Known Implementing Classes:
AbstractRequestInterceptor, DefaultRequestInterceptor, DistributedScheduler, FederationInterceptor

public interface RequestInterceptor extends org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol, org.apache.hadoop.conf.Configurable
Defines the contract to be implemented by the request interceptor classes, that can be used to intercept and inspect messages sent from the application master to the resource manager.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the context.
    Returns the next interceptor in the chain.
    void
    This method is called for initializing the interceptor.
    void
    recover(Map<String,byte[]> recoveredDataMap)
    Recover interceptor state when NM recovery is enabled.
    void
    Sets the next interceptor in the pipeline.
    void
    This method is called to release the resources held by the interceptor.

    Methods inherited from interface org.apache.hadoop.yarn.api.ApplicationMasterProtocol

    allocate, finishApplicationMaster, registerApplicationMaster

    Methods inherited from interface org.apache.hadoop.conf.Configurable

    getConf, setConf

    Methods inherited from interface org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol

    allocateForDistributedScheduling, registerApplicationMasterForDistributedScheduling
  • Method Details

    • init

      This method is called for initializing the interceptor. This is guaranteed to be called only once in the lifetime of this instance.
      Parameters:
      ctx - AMRMProxy application context
    • recover

      void recover(Map<String,byte[]> recoveredDataMap)
      Recover interceptor state when NM recovery is enabled. AMRMProxy will recover the data map into AMRMProxyApplicationContext.getRecoveredDataMap(). All interceptors should recover state from it. For example, registerRequest has to be saved by the last interceptor (i.e. the one that actually connects to RM), in order to re-register when RM fails over.
      Parameters:
      recoveredDataMap - states for all interceptors recovered from NMSS
    • shutdown

      void shutdown()
      This method is called to release the resources held by the interceptor. This will be called when the application pipeline is being destroyed. The concrete implementations should dispose the resources and forward the request to the next interceptor, if any.
    • setNextInterceptor

      void setNextInterceptor(RequestInterceptor nextInterceptor)
      Sets the next interceptor in the pipeline. The concrete implementation of this interface should always pass the request to the nextInterceptor after inspecting the message. The last interceptor in the chain is responsible to send the messages to the resource manager service and so the last interceptor will not receive this method call.
      Parameters:
      nextInterceptor - the next interceptor to set
    • getNextInterceptor

      RequestInterceptor getNextInterceptor()
      Returns the next interceptor in the chain.
      Returns:
      the next interceptor in the chain
    • getApplicationContext

      AMRMProxyApplicationContext getApplicationContext()
      Returns the context.
      Returns:
      the context