@Override
  public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
      throws YarnException, IOException {
    if (request == null) {
      routerMetrics.incrClusterNodesFailedRetrieved();
      String msg = "Missing getClusterNodes request.";
      RouterAuditLogger.logFailure(user.getShortUserName(), GET_CLUSTERNODES, UNKNOWN,
          TARGET_CLIENT_RM_SERVICE, msg);
      RouterServerUtil.logAndThrowException(msg, null);
    }
    long startTime = clock.getTime();
    ClientMethod remoteMethod = new ClientMethod("getClusterNodes",
        new Class[]{GetClusterNodesRequest.class}, new Object[]{request});
    try {
      Collection<GetClusterNodesResponse> clusterNodes =
          invokeConcurrent(remoteMethod, GetClusterNodesResponse.class);
      long stopTime = clock.getTime();
      routerMetrics.succeededGetClusterNodesRetrieved(stopTime - startTime);
      RouterAuditLogger.logSuccess(user.getShortUserName(), GET_CLUSTERNODES,
          TARGET_CLIENT_RM_SERVICE);
      return RouterYarnClientUtils.mergeClusterNodesResponse(clusterNodes);
    } catch (Exception ex) {
      routerMetrics.incrClusterNodesFailedRetrieved();
      String msg = "Unable to get cluster nodes due to exception.";
      RouterAuditLogger.logFailure(user.getShortUserName(), GET_CLUSTERNODES, UNKNOWN,
          TARGET_CLIENT_RM_SERVICE, msg);
      RouterServerUtil.logAndThrowException(msg, ex);
    }
    throw new YarnException("Unable to get cluster nodes.");
  }
@Test
  public void testGetClusterNodesRequest() throws Exception {
    LOG.info("Test FederationClientInterceptor : Get Cluster Nodes request.");
    // null request
    LambdaTestUtils.intercept(YarnException.class, "Missing getClusterNodes request.",
        () -> interceptor.getClusterNodes(null));
    // normal request.
    GetClusterNodesResponse response =
        interceptor.getClusterNodes(GetClusterNodesRequest.newInstance());
    Assert.assertEquals(subClusters.size(), response.getNodeReports().size());
  }