@Override
    protected void handleReportForDutyResponse(RegionServerStartupResponse c) throws IOException {
      if (killedRS.compareAndSet(null, getServerName())) {
        // Make sure Master is up so it will see the removal of the ephemeral znode for this RS.
        while (!masterActive.get()) {
          Threads.sleep(100);
        }
        super.kill();
      } else {
        super.handleReportForDutyResponse(c);
      }
    }
A RegionServer that reports for duty and then immediately dies if it is the first to receive
the response to a reportForDuty. When it dies, it clears its ephemeral znode which the master
notices and so removes the region from its set of online regionservers.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSKilledWhenInitializing.java