containerHeartbeatHandler = createContainerHeartbeatHandler(context, conf);
addIfService(containerHeartbeatHandler, true);
String sessionTokenUUID = UUID.randomUUID().toString();
JobTokenIdentifier identifier = new JobTokenIdentifier(new Text(
sessionTokenUUID));
sessionToken = new Token<JobTokenIdentifier>(identifier,
jobTokenSecretManager);
sessionToken.setService(identifier.getJobId());
TokenCache.setSessionToken(sessionToken, amTokens);
// Prepare the TaskAttemptListener server for authentication of Containers
// TaskAttemptListener gets the information via jobTokenSecretManager.
jobTokenSecretManager.addTokenForJob(sessionTokenUUID, sessionToken);
LOG.info("Adding session token to jobTokenSecretManager for sessionTokenUUID: " + sessionTokenUUID);