org.apache.hadoop.yarn.server

## Class AMHeartbeatRequestHandler

- java.lang.Object
- - java.lang.Thread
  - - org.apache.hadoop.yarn.server.AMHeartbeatRequestHandler

- All Implemented Interfaces:
    Runnable

      public class AMHeartbeatRequestHandler
      extends Thread

  Extends Thread and provides an implementation that is used for processing the AM heart beat request asynchronously and sending back the response using the callback method registered with the system.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AMHeartbeatRequestHandler.AsyncAllocateRequestInfo` Data structure that encapsulates AllocateRequest and AsyncCallback instance.
    `class` | `AMHeartbeatRequestHandler.HeartBeatThreadUncaughtExceptionHandler` Uncaught exception handler for the background heartbeat thread.

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `Thread.State, Thread.UncaughtExceptionHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.slf4j.Logger` | `LOG`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AMHeartbeatRequestHandler(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.records.ApplicationId applicationId)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `allocateAsync(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest request, org.apache.hadoop.yarn.util.AsyncCallback<org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse> callback)` Sends the specified heart beat request to the resource manager and invokes the callback asynchronously with the response.
    `void` | `drainHeartbeatThread()`
    `int` | `getRequestQueueSize()`
    `void` | `resetLastResponseId()` Reset the lastResponseId to zero.
    `void` | `run()`
    `void` | `setAMRMClientRelayer(AMRMClientRelayer relayer)` Set the AMRMClientRelayer for RM connection.
    `void` | `setUGI(org.apache.hadoop.security.UserGroupInformation ugi)` Set the UGI for RM connection.
    `void` | `shutdown()` Shutdown the thread.

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### LOG

          public static final org.slf4j.Logger LOG

  - ### Constructor Detail

    - #### AMHeartbeatRequestHandler

          public AMHeartbeatRequestHandler(org.apache.hadoop.conf.Configuration conf,
                                           org.apache.hadoop.yarn.api.records.ApplicationId applicationId)

  - ### Method Detail

    - #### shutdown

          public void shutdown()

      Shutdown the thread.

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`
      Overrides:
        `run` in class `Thread`

    - #### resetLastResponseId

          public void resetLastResponseId()

      Reset the lastResponseId to zero.

    - #### setAMRMClientRelayer

          public void setAMRMClientRelayer(AMRMClientRelayer relayer)

      Set the AMRMClientRelayer for RM connection.

    - #### setUGI

          public void setUGI(org.apache.hadoop.security.UserGroupInformation ugi)

      Set the UGI for RM connection.

    - #### allocateAsync

          public void allocateAsync(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest request,
                                    org.apache.hadoop.yarn.util.AsyncCallback<org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse> callback)
                             throws org.apache.hadoop.yarn.exceptions.YarnException

      Sends the specified heart beat request to the resource manager and invokes the callback asynchronously with the response.
      Parameters:
        `request` - the allocate request
        `callback` - the callback method for the request
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if registerAM is not called yet

    - #### drainHeartbeatThread

          public void drainHeartbeatThread()

    - #### getRequestQueueSize

          public int getRequestQueueSize()

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.