@Override
  public void handleAdminRequest(NetworkRequest request) throws InterruptedException, IOException {
    long requestQueueTime = SystemTime.getInstance().milliseconds() - request.getStartTimeInMs();
    long totalTimeSpent = requestQueueTime;
    long startTime = SystemTime.getInstance().milliseconds();
    DataInputStream requestStream = new DataInputStream(request.getInputStream());
    AdminRequest adminRequest = AdminRequest.readFrom(requestStream, clusterMap);
    Histogram responseQueueTimeHistogram;
    Histogram responseSendTimeHistogram;
    Histogram requestTotalTimeHistogram;
    AdminResponse response = null;
    try {
      switch (adminRequest.getType()) {
        case TriggerCompaction:
          response = handleTriggerCompactionRequest(adminRequest);
          break;
        case RequestControl:
          response = handleRequestControlRequest(requestStream, adminRequest);
          break;
        case ReplicationControl:
          response = handleReplicationControlRequest(requestStream, adminRequest);
          break;
        case CatchupStatus:
          response = handleCatchupStatusRequest(requestStream, adminRequest);
          break;
        case BlobStoreControl:
          response = handleBlobStoreControlRequest(requestStream, adminRequest);
          break;
        case HealthCheck:
          response = handleHealthCheckRequest(requestStream, adminRequest);
          break;
        case BlobIndex:
          response = handleBlobIndexRequest(requestStream, adminRequest);
          break;
        case ForceDelete:
          response = handleForceDeleteRequest(requestStream, adminRequest);
          break;
      }
    } catch (Exception e) {
      logger.error("Unknown exception for admin request {}", adminRequest, e);
      metrics.unExpectedAdminOperationError.inc();
      response =
          new AdminResponse(adminRequest.getCorrelationId(), adminRequest.getClientId(), ServerErrorCode.UnknownError);
      switch (adminRequest.getType()) {
        case CatchupStatus:
          response = new CatchupStatusAdminResponse(false, response);
          break;
        case HealthCheck:
        case BlobIndex:
          response = new AdminResponseWithContent(adminRequest.getCorrelationId(), adminRequest.getClientId(),
              ServerErrorCode.UnknownError);
          break;
        case ForceDelete:
          response = new AdminResponse(adminRequest.getCorrelationId(), adminRequest.getClientId(),
              ServerErrorCode.UnknownError);
          break;
      }
    } finally {
      long processingTime = SystemTime.getInstance().milliseconds() - startTime;
      totalTimeSpent += processingTime;
      publicAccessLogger.info("{} {} processingTime {}", adminRequest, response, processingTime);
      // Update request metrics.
      RequestMetricsUpdater metricsUpdater = new RequestMetricsUpdater(requestQueueTime, processingTime, 0, 0, false);
      adminRequest.accept(metricsUpdater);
      responseQueueTimeHistogram = metricsUpdater.getResponseQueueTimeHistogram();
      responseSendTimeHistogram = metricsUpdater.getResponseSendTimeHistogram();
      requestTotalTimeHistogram = metricsUpdater.getRequestTotalTimeHistogram();
    }
    requestResponseChannel.sendResponse(response, request,
        new ServerNetworkResponseMetrics(responseQueueTimeHistogram, responseSendTimeHistogram,
            requestTotalTimeHistogram, null, null, totalTimeSpent));
  }
Handles an administration request. These requests can query for or change the internal state of the server.
@param request the request that needs to be handled.
@throws InterruptedException if response sending is interrupted.
@throws IOException if there are I/O errors carrying our the required operation.
ambry-server/src/main/java/com/github/ambry/server/AmbryServerRequests.java