Java Code Examples for org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse#setNMTokenMasterKey()

The following examples show how to use org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse#setNMTokenMasterKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YarnServerBuilderUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static NodeHeartbeatResponse newNodeHeartbeatResponse(int responseId,
    NodeAction action, List<ContainerId> containersToCleanUp,
    List<ApplicationId> applicationsToCleanUp,
    MasterKey containerTokenMasterKey, MasterKey nmTokenMasterKey,
    long nextHeartbeatInterval) {
  NodeHeartbeatResponse response = recordFactory
      .newRecordInstance(NodeHeartbeatResponse.class);
  response.setResponseId(responseId);
  response.setNodeAction(action);
  response.setContainerTokenMasterKey(containerTokenMasterKey);
  response.setNMTokenMasterKey(nmTokenMasterKey);
  response.setNextHeartBeatInterval(nextHeartbeatInterval);
  if(containersToCleanUp != null) {
    response.addAllContainersToCleanup(containersToCleanUp);
  }
  if(applicationsToCleanUp != null) {
    response.addAllApplicationsToCleanup(applicationsToCleanUp);
  }
  return response;
}
 
Example 2
Source File: ResourceTrackerService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void populateKeys(NodeHeartbeatRequest request,
    NodeHeartbeatResponse nodeHeartBeatResponse) {

  // Check if node's masterKey needs to be updated and if the currentKey has
  // roller over, send it across

  // ContainerTokenMasterKey

  MasterKey nextMasterKeyForNode =
      this.containerTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownContainerTokenMasterKey().getKeyId()
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setContainerTokenMasterKey(nextMasterKeyForNode);
  }

  // NMTokenMasterKey

  nextMasterKeyForNode = this.nmTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownNMTokenMasterKey().getKeyId() 
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setNMTokenMasterKey(nextMasterKeyForNode);
  }
}
 
Example 3
Source File: YarnServerBuilderUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static NodeHeartbeatResponse newNodeHeartbeatResponse(int responseId,
    NodeAction action, List<ContainerId> containersToCleanUp,
    List<ApplicationId> applicationsToCleanUp,List<NodeContainerUpdate> listNodeContainerUpdate,
    MasterKey containerTokenMasterKey, MasterKey nmTokenMasterKey,
    long nextHeartbeatInterval) {
  NodeHeartbeatResponse response = recordFactory
      .newRecordInstance(NodeHeartbeatResponse.class);
  response.setResponseId(responseId);
  response.setNodeAction(action);
  response.setContainerTokenMasterKey(containerTokenMasterKey);
  response.setNMTokenMasterKey(nmTokenMasterKey);
  response.setNextHeartBeatInterval(nextHeartbeatInterval);
  
  if(containersToCleanUp != null) {
    response.addAllContainersToCleanup(containersToCleanUp);
  }
  if(applicationsToCleanUp != null) {
    response.addAllApplicationsToCleanup(applicationsToCleanUp);
  }
  if(listNodeContainerUpdate != null){
    response.addNodeContainersToUpdate(listNodeContainerUpdate);	
  }
  return response;
}
 
Example 4
Source File: ResourceTrackerService.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void populateKeys(NodeHeartbeatRequest request,
    NodeHeartbeatResponse nodeHeartBeatResponse) {

  // Check if node's masterKey needs to be updated and if the currentKey has
  // roller over, send it across

  // ContainerTokenMasterKey

  MasterKey nextMasterKeyForNode =
      this.containerTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownContainerTokenMasterKey().getKeyId()
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setContainerTokenMasterKey(nextMasterKeyForNode);
  }

  // NMTokenMasterKey

  nextMasterKeyForNode = this.nmTokenSecretManager.getNextKey();
  if (nextMasterKeyForNode != null
      && (request.getLastKnownNMTokenMasterKey().getKeyId() 
          != nextMasterKeyForNode.getKeyId())) {
    nodeHeartBeatResponse.setNMTokenMasterKey(nextMasterKeyForNode);
  }
}