Пример #1
0
 protected void register() {
   // Register
   InetSocketAddress serviceAddr = null;
   if (clientService != null) {
     serviceAddr = clientService.getBindAddress();
   }
   try {
     RegisterApplicationMasterRequest request =
         recordFactory.newRecordInstance(RegisterApplicationMasterRequest.class);
     if (serviceAddr != null) {
       request.setHost(serviceAddr.getHostName());
       request.setRpcPort(serviceAddr.getPort());
       request.setTrackingUrl(serviceAddr.getHostName() + ":" + clientService.getHttpPort());
     }
     RegisterApplicationMasterResponse response = scheduler.registerApplicationMaster(request);
     maxContainerCapability = response.getMaximumResourceCapability();
     this.context.getClusterInfo().setMaxContainerCapability(maxContainerCapability);
     if (UserGroupInformation.isSecurityEnabled()) {
       setClientToAMToken(response.getClientToAMTokenMasterKey());
     }
     this.applicationACLs = response.getApplicationACLs();
     LOG.info("maxContainerCapability: " + maxContainerCapability.getMemory());
   } catch (Exception are) {
     LOG.error("Exception while registering", are);
     throw new YarnRuntimeException(are);
   }
 }
 private RegisterApplicationMasterResponse registerApplicationMaster()
     throws YarnException, IOException {
   RegisterApplicationMasterRequest request =
       RegisterApplicationMasterRequest.newInstance(
           this.appHostName, this.appHostPort, this.appTrackingUrl);
   RegisterApplicationMasterResponse response = rmClient.registerApplicationMaster(request);
   synchronized (this) {
     lastResponseId = 0;
     if (!response.getNMTokensFromPreviousAttempts().isEmpty()) {
       populateNMTokens(response.getNMTokensFromPreviousAttempts());
     }
   }
   return response;
 }
 @Override
 public RegisterApplicationMasterResponseProto registerApplicationMaster(
     RpcController arg0, RegisterApplicationMasterRequestProto proto) throws ServiceException {
   RegisterApplicationMasterRequestPBImpl request =
       new RegisterApplicationMasterRequestPBImpl(proto);
   try {
     RegisterApplicationMasterResponse response = real.registerApplicationMaster(request);
     return ((RegisterApplicationMasterResponsePBImpl) response).getProto();
   } catch (YarnException e) {
     throw new ServiceException(e);
   } catch (IOException e) {
     throw new ServiceException(e);
   }
 }