@Override
  public Response deleteReservation(ReservationDeleteRequestInfo resContext,
      HttpServletRequest hsr)
      throws AuthorizationException, IOException, InterruptedException {

    // parameter verification
    if (resContext == null || resContext.getReservationId() == null) {
      routerMetrics.incrDeleteReservationFailedRetrieved();
      String errMsg = "Missing deleteReservation request or reservationId.";
      RouterAuditLogger.logFailure(getUser().getShortUserName(), DELETE_RESERVATION,
          UNKNOWN, TARGET_WEB_SERVICE, errMsg);
      return Response.status(Status.BAD_REQUEST).entity(errMsg).build();
    }

    // get ReservationId
    String reservationId = resContext.getReservationId();

    // Check that the reservationId format is accurate
    try {
      RouterServerUtil.validateReservationId(reservationId);
    } catch (IllegalArgumentException e) {
      routerMetrics.incrDeleteReservationFailedRetrieved();
      RouterAuditLogger.logFailure(getUser().getShortUserName(), DELETE_RESERVATION,
          UNKNOWN, TARGET_WEB_SERVICE, e.getLocalizedMessage());
      throw e;
    }

    try {
      SubClusterInfo subClusterInfo = getHomeSubClusterInfoByReservationId(reservationId);
      DefaultRequestInterceptorREST interceptor = getOrCreateInterceptorForSubCluster(
          subClusterInfo.getSubClusterId(), subClusterInfo.getRMWebServiceAddress());
      HttpServletRequest hsrCopy = clone(hsr);
      Response response = interceptor.deleteReservation(resContext, hsrCopy);
      if (response != null) {
        RouterAuditLogger.logSuccess(getUser().getShortUserName(), DELETE_RESERVATION,
            TARGET_WEB_SERVICE);
        return response;
      }
    } catch (Exception e) {
      routerMetrics.incrDeleteReservationFailedRetrieved();
      RouterAuditLogger.logFailure(getUser().getShortUserName(), DELETE_RESERVATION,
          UNKNOWN, TARGET_WEB_SERVICE, e.getLocalizedMessage());
      RouterServerUtil.logAndThrowRunTimeException("deleteReservation Failed.", e);
    }

    // throw an exception
    routerMetrics.incrDeleteReservationFailedRetrieved();
    RouterAuditLogger.logFailure(getUser().getShortUserName(), DELETE_RESERVATION,
        UNKNOWN, TARGET_WEB_SERVICE, "deleteReservation Failed, reservationId = " + reservationId);
    throw new YarnRuntimeException("deleteReservation Failed, reservationId = " + reservationId);
  }
@Test
  public void testDeleteReservation() throws Exception {
    // submit reservation
    ReservationId reservationId = ReservationId.newInstance(Time.now(), 4);
    Response response = submitReservation(reservationId);
    Assert.assertNotNull(response);
    Assert.assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());

    String applyResId = reservationId.toString();
    Response reservationResponse = interceptor.listReservation(
        QUEUE_DEDICATED_FULL, applyResId, -1, -1, false, null);
    Assert.assertNotNull(reservationResponse);

    ReservationDeleteRequestInfo deleteRequestInfo =
        new ReservationDeleteRequestInfo();
    deleteRequestInfo.setReservationId(applyResId);
    Response delResponse = interceptor.deleteReservation(deleteRequestInfo, null);
    Assert.assertNotNull(delResponse);

    LambdaTestUtils.intercept(Exception.class,
        "reservationId with id: " + reservationId + " not found",
        () -> interceptor.listReservation(QUEUE_DEDICATED_FULL, applyResId, -1, -1, false, null));
  }