@Override
  public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
    if (!restServerState.isServiceUp()) {
      if (msg instanceof LastHttpContent) {
        // Start closing client channels after we've completed writing to them (even if they are keep-alive)
        logger.info("Health check request handler closing connection {} since in shutdown mode.", ctx.channel());
        promise.addListener(ChannelFutureListener.CLOSE);
        nettyMetrics.healthCheckHandlerChannelCloseOnWriteCount.inc();
      }
    }
    super.write(ctx, msg, promise);
  }
Responsible for responding to health check requests
{@link RestServerState} assists in knowing the state of the system at any point in time
ambry-rest/src/main/java/com/github/ambry/rest/HealthCheckHandler.java