Java Code Examples for org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest

The following examples show how to use org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest. These examples are extracted from open source projects. 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 Project: hadoop   Source File: TestResourceTrackerPBClientImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Test the method nodeHeartbeat. Method should return a not null result.
 * 
 */

@Test
public void testNodeHeartbeat() throws Exception {
  NodeHeartbeatRequest request = recordFactory
      .newRecordInstance(NodeHeartbeatRequest.class);
  assertNotNull(client.nodeHeartbeat(request));
  
  ResourceTrackerTestImpl.exception = true;
  try {
    client.nodeHeartbeat(request);
    fail("there  should be YarnException");
  } catch (YarnException e) {
    assertTrue(e.getMessage().startsWith("testMessage"));
  }finally{
    ResourceTrackerTestImpl.exception = false;
  }

}
 
Example 2
Source Project: hadoop   Source File: ResourceTrackerService.java    License: 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 Project: hadoop   Source File: TestNMExpiry.java    License: Apache License 2.0 6 votes vote down vote up
public void run() {
  int lastResponseID = 0;
  while (!stopT) {
    try {
      org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus =
          recordFactory
              .newRecordInstance(org.apache.hadoop.yarn.server.api.records.NodeStatus.class);
      nodeStatus.setNodeId(request3.getNodeId());
      nodeStatus.setResponseId(lastResponseID);
      nodeStatus.setNodeHealthStatus(recordFactory.newRecordInstance(NodeHealthStatus.class));
      nodeStatus.getNodeHealthStatus().setIsNodeHealthy(true);

      NodeHeartbeatRequest request = recordFactory
          .newRecordInstance(NodeHeartbeatRequest.class);
      request.setNodeStatus(nodeStatus);
      lastResponseID = resourceTrackerService.nodeHeartbeat(request)
          .getResponseId();

      Thread.sleep(1000);
    } catch(Exception e) {
      LOG.info("failed to heartbeat ", e);
    }
  }
}
 
Example 4
Source Project: hadoop   Source File: TestResourceTrackerOnHA.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
Example 5
Source Project: big-c   Source File: TestResourceTrackerPBClientImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Test the method nodeHeartbeat. Method should return a not null result.
 * 
 */

@Test
public void testNodeHeartbeat() throws Exception {
  NodeHeartbeatRequest request = recordFactory
      .newRecordInstance(NodeHeartbeatRequest.class);
  assertNotNull(client.nodeHeartbeat(request));
  
  ResourceTrackerTestImpl.exception = true;
  try {
    client.nodeHeartbeat(request);
    fail("there  should be YarnException");
  } catch (YarnException e) {
    assertTrue(e.getMessage().startsWith("testMessage"));
  }finally{
    ResourceTrackerTestImpl.exception = false;
  }

}
 
Example 6
Source Project: big-c   Source File: ResourceTrackerService.java    License: 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 7
Source Project: big-c   Source File: TestNMExpiry.java    License: Apache License 2.0 6 votes vote down vote up
public void run() {
  int lastResponseID = 0;
  while (!stopT) {
    try {
      org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus =
          recordFactory
              .newRecordInstance(org.apache.hadoop.yarn.server.api.records.NodeStatus.class);
      nodeStatus.setNodeId(request3.getNodeId());
      nodeStatus.setResponseId(lastResponseID);
      nodeStatus.setNodeHealthStatus(recordFactory.newRecordInstance(NodeHealthStatus.class));
      nodeStatus.getNodeHealthStatus().setIsNodeHealthy(true);

      NodeHeartbeatRequest request = recordFactory
          .newRecordInstance(NodeHeartbeatRequest.class);
      request.setNodeStatus(nodeStatus);
      lastResponseID = resourceTrackerService.nodeHeartbeat(request)
          .getResponseId();

      Thread.sleep(1000);
    } catch(Exception e) {
      LOG.info("failed to heartbeat ", e);
    }
  }
}
 
Example 8
Source Project: big-c   Source File: TestResourceTrackerOnHA.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
Example 9
Source Project: hadoop   Source File: ResourceTrackerPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeHeartbeatRequestProto requestProto = ((NodeHeartbeatRequestPBImpl)request).getProto();
  try {
    return new NodeHeartbeatResponsePBImpl(proxy.nodeHeartbeat(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example 10
Source Project: hadoop   Source File: TestYSCRecordFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testPbRecordFactory() {
  RecordFactory pbRecordFactory = RecordFactoryPBImpl.get();
  try {
    NodeHeartbeatRequest request = pbRecordFactory.newRecordInstance(NodeHeartbeatRequest.class);
    Assert.assertEquals(NodeHeartbeatRequestPBImpl.class, request.getClass());
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to crete record");
  }
  
}
 
Example 11
Source Project: hadoop   Source File: TestResourceTrackerPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  if (exception) {
    throw new YarnException("testMessage");
  }
  return recordFactory.newRecordInstance(NodeHeartbeatResponse.class);
}
 
Example 12
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, heartBeatNodeAction, null,
          null, null, null, 1000L);
  nhResponse.setDiagnosticsMessage(shutDownMessage);
  return nhResponse;
}
 
Example 13
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  LOG.info("Got heartBeatId: [" + heartBeatID +"]");
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);
  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, heartBeatNodeAction, null,
          null, null, null, 1000L);

  if (nodeStatus.getKeepAliveApplications() != null
      && nodeStatus.getKeepAliveApplications().size() > 0) {
    for (ApplicationId appId : nodeStatus.getKeepAliveApplications()) {
      List<Long> list = keepAliveRequests.get(appId);
      if (list == null) {
        list = new LinkedList<Long>();
        keepAliveRequests.put(appId, list);
      }
      list.add(System.currentTimeMillis());
    }
  }
  if (heartBeatID == 2) {
    LOG.info("Sending FINISH_APP for application: [" + appId + "]");
    this.context.getApplications().put(appId, mock(Application.class));
    nhResponse.addAllApplicationsToCleanup(Collections.singletonList(appId));
  }
  return nhResponse;
}
 
Example 14
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  heartBeatID++;
  if(heartBeatID == 1) {
    // EOFException should be retried as well.
    throw new EOFException("NodeHeartbeat exception");
  }
  else {
  throw new java.net.ConnectException(
      "NodeHeartbeat exception");
  }
}
 
Example 15
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, NodeAction.NORMAL, null,
          null, null, null, 1000L);
  return nhResponse;
}
 
Example 16
Source Project: hadoop   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  LOG.info("Got heartbeat number " + heartBeatID);
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils
      .newNodeHeartbeatResponse(heartBeatID, null, null,
          null, null, null, 1000L);
  return nhResponse;
}
 
Example 17
Source Project: hadoop   Source File: NodeManager.java    License: Apache License 2.0 5 votes vote down vote up
public void heartbeat() throws IOException, YarnException {
  NodeStatus nodeStatus = 
    org.apache.hadoop.yarn.server.resourcemanager.NodeManager.createNodeStatus(
        nodeId, getContainerStatuses(containers));
  nodeStatus.setResponseId(responseID);
  NodeHeartbeatRequest request = recordFactory
      .newRecordInstance(NodeHeartbeatRequest.class);
  request.setNodeStatus(nodeStatus);
  NodeHeartbeatResponse response = resourceTrackerService
      .nodeHeartbeat(request);
  responseID = response.getResponseId();
}
 
Example 18
Source Project: hadoop   Source File: MockNM.java    License: Apache License 2.0 5 votes vote down vote up
public NodeHeartbeatResponse nodeHeartbeat(Map<ApplicationId,
    List<ContainerStatus>> conts, boolean isHealthy, int resId) throws Exception {
  NodeHeartbeatRequest req = Records.newRecord(NodeHeartbeatRequest.class);
  NodeStatus status = Records.newRecord(NodeStatus.class);
  status.setResponseId(resId);
  status.setNodeId(nodeId);
  for (Map.Entry<ApplicationId, List<ContainerStatus>> entry : conts.entrySet()) {
    Log.info("entry.getValue() " + entry.getValue());
    status.setContainersStatuses(entry.getValue());
  }
  NodeHealthStatus healthStatus = Records.newRecord(NodeHealthStatus.class);
  healthStatus.setHealthReport("");
  healthStatus.setIsNodeHealthy(isHealthy);
  healthStatus.setLastHealthReportTime(1);
  status.setNodeHealthStatus(healthStatus);
  req.setNodeStatus(status);
  req.setLastKnownContainerTokenMasterKey(this.currentContainerTokenMasterKey);
  req.setLastKnownNMTokenMasterKey(this.currentNMTokenMasterKey);
  NodeHeartbeatResponse heartbeatResponse =
      resourceTracker.nodeHeartbeat(req);
  
  MasterKey masterKeyFromRM = heartbeatResponse.getContainerTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentContainerTokenMasterKey
          .getKeyId()) {
    this.currentContainerTokenMasterKey = masterKeyFromRM;
  }

  masterKeyFromRM = heartbeatResponse.getNMTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentNMTokenMasterKey
          .getKeyId()) {
    this.currentNMTokenMasterKey = masterKeyFromRM;
  }
  
  return heartbeatResponse;
}
 
Example 19
Source Project: hadoop   Source File: ProtocolHATestBase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);
  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());
  return super.nodeHeartbeat(request);
}
 
Example 20
Source Project: big-c   Source File: ResourceTrackerPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeHeartbeatRequestProto requestProto = ((NodeHeartbeatRequestPBImpl)request).getProto();
  try {
    return new NodeHeartbeatResponsePBImpl(proxy.nodeHeartbeat(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example 21
Source Project: big-c   Source File: TestYSCRecordFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testPbRecordFactory() {
  RecordFactory pbRecordFactory = RecordFactoryPBImpl.get();
  try {
    NodeHeartbeatRequest request = pbRecordFactory.newRecordInstance(NodeHeartbeatRequest.class);
    Assert.assertEquals(NodeHeartbeatRequestPBImpl.class, request.getClass());
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to crete record");
  }
  
}
 
Example 22
Source Project: big-c   Source File: TestResourceTrackerPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  if (exception) {
    throw new YarnException("testMessage");
  }
  return recordFactory.newRecordInstance(NodeHeartbeatResponse.class);
}
 
Example 23
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, heartBeatNodeAction, null,
          null, null, null, null, 1000L);
  nhResponse.setDiagnosticsMessage(shutDownMessage);
  return nhResponse;
}
 
Example 24
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  LOG.info("Got heartBeatId: [" + heartBeatID +"]");
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);
  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, heartBeatNodeAction, null,
          null, null, null, null, 1000L);

  if (nodeStatus.getKeepAliveApplications() != null
      && nodeStatus.getKeepAliveApplications().size() > 0) {
    for (ApplicationId appId : nodeStatus.getKeepAliveApplications()) {
      List<Long> list = keepAliveRequests.get(appId);
      if (list == null) {
        list = new LinkedList<Long>();
        keepAliveRequests.put(appId, list);
      }
      list.add(System.currentTimeMillis());
    }
  }
  if (heartBeatID == 2) {
    LOG.info("Sending FINISH_APP for application: [" + appId + "]");
    this.context.getApplications().put(appId, mock(Application.class));
    nhResponse.addAllApplicationsToCleanup(Collections.singletonList(appId));
  }
  return nhResponse;
}
 
Example 25
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  heartBeatID++;
  if(heartBeatID == 1) {
    // EOFException should be retried as well.
    throw new EOFException("NodeHeartbeat exception");
  }
  else {
  throw new java.net.ConnectException(
      "NodeHeartbeat exception");
  }
}
 
Example 26
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.
      newNodeHeartbeatResponse(heartBeatID, NodeAction.NORMAL, null,
          null, null, null, null, 1000L);
  return nhResponse;
}
 
Example 27
Source Project: big-c   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  NodeStatus nodeStatus = request.getNodeStatus();
  LOG.info("Got heartbeat number " + heartBeatID);
  nodeStatus.setResponseId(heartBeatID++);

  NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils
      .newNodeHeartbeatResponse(heartBeatID, null, null,
          null, null, null, null, 1000L);
  return nhResponse;
}
 
Example 28
Source Project: big-c   Source File: NodeManager.java    License: Apache License 2.0 5 votes vote down vote up
public void heartbeat() throws IOException, YarnException {
  NodeStatus nodeStatus = 
    org.apache.hadoop.yarn.server.resourcemanager.NodeManager.createNodeStatus(
        nodeId, getContainerStatuses(containers));
  nodeStatus.setResponseId(responseID);
  NodeHeartbeatRequest request = recordFactory
      .newRecordInstance(NodeHeartbeatRequest.class);
  request.setNodeStatus(nodeStatus);
  NodeHeartbeatResponse response = resourceTrackerService
      .nodeHeartbeat(request);
  responseID = response.getResponseId();
}
 
Example 29
Source Project: big-c   Source File: MockNM.java    License: Apache License 2.0 5 votes vote down vote up
public NodeHeartbeatResponse nodeHeartbeat(Map<ApplicationId,
    List<ContainerStatus>> conts, boolean isHealthy, int resId) throws Exception {
  NodeHeartbeatRequest req = Records.newRecord(NodeHeartbeatRequest.class);
  NodeStatus status = Records.newRecord(NodeStatus.class);
  status.setResponseId(resId);
  status.setNodeId(nodeId);
  for (Map.Entry<ApplicationId, List<ContainerStatus>> entry : conts.entrySet()) {
    Log.info("entry.getValue() " + entry.getValue());
    status.setContainersStatuses(entry.getValue());
  }
  NodeHealthStatus healthStatus = Records.newRecord(NodeHealthStatus.class);
  healthStatus.setHealthReport("");
  healthStatus.setIsNodeHealthy(isHealthy);
  healthStatus.setLastHealthReportTime(1);
  status.setNodeHealthStatus(healthStatus);
  req.setNodeStatus(status);
  req.setLastKnownContainerTokenMasterKey(this.currentContainerTokenMasterKey);
  req.setLastKnownNMTokenMasterKey(this.currentNMTokenMasterKey);
  NodeHeartbeatResponse heartbeatResponse =
      resourceTracker.nodeHeartbeat(req);
  
  MasterKey masterKeyFromRM = heartbeatResponse.getContainerTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentContainerTokenMasterKey
          .getKeyId()) {
    this.currentContainerTokenMasterKey = masterKeyFromRM;
  }

  masterKeyFromRM = heartbeatResponse.getNMTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentNMTokenMasterKey
          .getKeyId()) {
    this.currentNMTokenMasterKey = masterKeyFromRM;
  }
  
  return heartbeatResponse;
}
 
Example 30
Source Project: big-c   Source File: ProtocolHATestBase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);
  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());
  return super.nodeHeartbeat(request);
}