Package org.apache.hadoop.yarn.server
Class AMHeartbeatRequestHandler
java.lang.Object
java.lang.Thread
org.apache.hadoop.util.concurrent.SubjectInheritingThread
org.apache.hadoop.yarn.server.AMHeartbeatRequestHandler
- All Implemented Interfaces:
Runnable
public class AMHeartbeatRequestHandler
extends org.apache.hadoop.util.concurrent.SubjectInheritingThread
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 ClassesModifier and TypeClassDescriptionstatic classData structure that encapsulates AllocateRequest and AsyncCallback instance.classUncaught exception handler for the background heartbeat thread.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAMHeartbeatRequestHandler(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, AMRMClientRelayer rmProxyRelayer) -
Method Summary
Modifier and TypeMethodDescriptionvoidallocateAsync(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.voidintvoidReset the lastResponseId to zero.voidsetUGI(org.apache.hadoop.security.UserGroupInformation ugi) Set the UGI for RM connection.voidshutdown()Shutdown the thread.voidwork()Methods inherited from class org.apache.hadoop.util.concurrent.SubjectInheritingThread
run, startMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
AMHeartbeatRequestHandler
public AMHeartbeatRequestHandler(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, AMRMClientRelayer rmProxyRelayer)
-
-
Method Details
-
shutdown
public void shutdown()Shutdown the thread. -
work
public void work()- Overrides:
workin classorg.apache.hadoop.util.concurrent.SubjectInheritingThread
-
resetLastResponseId
public void resetLastResponseId()Reset the lastResponseId to zero. -
setUGI
public void setUGI(org.apache.hadoop.security.UserGroupInformation ugi) Set the UGI for RM connection.- Parameters:
ugi- UserGroupInformation.
-
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 requestcallback- the callback method for the request- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if registerAM is not called yet
-
drainHeartbeatThread
@VisibleForTesting public void drainHeartbeatThread() -
getRequestQueueSize
@VisibleForTesting public int getRequestQueueSize()
-