@Override
  public ContainerInfo getContainer(HttpServletRequest req,
      HttpServletResponse res, String appId, String appAttemptId,
      String containerId) {

    // FederationInterceptorREST#getContainer is logically
    // the same as FederationClientInterceptor#getContainerReport,
    // so use the same Metric.

    // Check that the appId/appAttemptId/containerId format is accurate
    try {
      RouterServerUtil.validateApplicationAttemptId(appAttemptId);
      RouterServerUtil.validateContainerId(containerId);
    } catch (IllegalArgumentException e) {
      routerMetrics.incrGetContainerReportFailedRetrieved();
      RouterAuditLogger.logFailure(getUser().getShortUserName(), GET_CONTAINER,
          UNKNOWN, TARGET_WEB_SERVICE, e.getLocalizedMessage());
      throw e;
    }

    try {
      long startTime = Time.now();
      DefaultRequestInterceptorREST interceptor = getOrCreateInterceptorByAppId(appId);
      ContainerInfo containerInfo =
          interceptor.getContainer(req, res, appId, appAttemptId, containerId);
      if (containerInfo != null) {
        long stopTime = Time.now();
        routerMetrics.succeededGetContainerReportRetrieved(stopTime - startTime);
        RouterAuditLogger.logSuccess(getUser().getShortUserName(), GET_CONTAINER,
            TARGET_WEB_SERVICE);
        return containerInfo;
      }
    } catch (IllegalArgumentException e) {
      String msg = String.format(
          "Unable to get the AppAttempt appId: %s, appAttemptId: %s, containerId: %s.", appId,
          appAttemptId, containerId);
      routerMetrics.incrGetContainerReportFailedRetrieved();
      RouterAuditLogger.logFailure(getUser().getShortUserName(), GET_CONTAINER,
          UNKNOWN, TARGET_WEB_SERVICE, e.getLocalizedMessage());
      RouterServerUtil.logAndThrowRunTimeException(msg, e);
    } catch (YarnException e) {
      routerMetrics.incrGetContainerReportFailedRetrieved();
      RouterAuditLogger.logFailure(getUser().getShortUserName(), GET_CONTAINER,
          UNKNOWN, TARGET_WEB_SERVICE, e.getLocalizedMessage());
      RouterServerUtil.logAndThrowRunTimeException("getContainer Failed.", e);
    }

    routerMetrics.incrGetContainerReportFailedRetrieved();
    RouterAuditLogger.logFailure(getUser().getShortUserName(), GET_CONTAINER,
        UNKNOWN, TARGET_WEB_SERVICE, "getContainer Failed.");
    throw new RuntimeException("getContainer Failed.");
  }
@Test
  public void testGetContainer() throws Exception {
    //
    ApplicationId appId = ApplicationId.newInstance(Time.now(), 1);
    ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, 1);
    ContainerId appContainerId = ContainerId.newContainerId(appAttemptId, 1);
    String applicationId = appId.toString();
    String attemptId = appAttemptId.toString();
    String containerId = appContainerId.toString();

    // Submit application to multiSubCluster
    ApplicationSubmissionContextInfo context = new ApplicationSubmissionContextInfo();
    context.setApplicationId(applicationId);
    Assert.assertNotNull(interceptor.submitApplication(context, null));

    // Test Case1: Wrong ContainerId
    LambdaTestUtils.intercept(IllegalArgumentException.class, "Invalid ContainerId prefix: 0",
        () -> interceptor.getContainer(null, null, applicationId, attemptId, "0"));

    // Test Case2: Correct ContainerId

    ContainerInfo containerInfo = interceptor.getContainer(null, null, applicationId,
        attemptId, containerId);
    Assert.assertNotNull(containerInfo);
  }