public void shutdown() {
    long startTime = SystemTime.getInstance().milliseconds();
    try {
      logger.info("VCR shutdown started");
      if (vcrReplicationManager != null) {
        vcrReplicationManager.shutdown();
      }
      if (reporter != null) {
        reporter.stop();
      }
      if (notificationSystem != null) {
        try {
          notificationSystem.close();
        } catch (IOException e) {
          logger.error("Error while closing notification system.", e);
        }
      }
      if (clusterMap != null) {
        clusterMap.close();
      }
      if (vcrClusterParticipant != null) {
        vcrClusterParticipant.close();
      }
      if (cloudDestination != null) {
        cloudDestination.close();
      }
      if (nettyInternalMetrics != null) {
        nettyInternalMetrics.stop();
      }
      logger.info("VCR shutdown completed");
    } catch (Exception e) {
      logger.error("Error while shutting down VCR", e);
    } finally {
      shutdownLatch.countDown();
      long processingTime = SystemTime.getInstance().milliseconds() - startTime;
      logger.info("VCR shutdown time in Ms {}", processingTime);
    }
  }
This method is expected to be called in the exit path as long as the AmbryServer instance construction was
successful. This is expected to be called even if {@link #startup()} did not succeed.
ambry-vcr/src/main/java/com/github/ambry/vcr/VcrServer.java