AMRMClientRelayer extends AbstractService implements ApplicationMasterProtocol { @Override public FinishApplicationMasterResponse finishApplicationMaster( FinishApplicationMasterRequest request) throws YarnException, IOException { try { return this.rmClient.finishApplicationMaster(request); } catch (ApplicationMasterNotRegisteredException e) { LOG.warn("Out of sync with RM " + rmId + " for " + this.appId + ", hence resyncing."); reRegisterApplicationMaster(this.amRegistrationRequest); return finishApplicationMaster(request); } } AMRMClientRelayer();  AMRMClientRelayer(ApplicationMasterProtocol rmClient,
      ApplicationId appId, String rmId); void setAMRegistrationRequest(
      RegisterApplicationMasterRequest registerRequest); void setRMClient(ApplicationMasterProtocol client); void shutdown(); @Override RegisterApplicationMasterResponse registerApplicationMaster(
      RegisterApplicationMasterRequest request); @Override FinishApplicationMasterResponse finishApplicationMaster(
      FinishApplicationMasterRequest request); @Override AllocateResponse allocate(AllocateRequest allocateRequest);  }
@Test public void testConcurrentReregister() throws YarnException, IOException { this.mockAMS.setFailoverFlag(); this.mockAMS.setThrowAlreadyRegister(); relayer.finishApplicationMaster(null); }