private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public GetDelegationTokenRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
@Override public GetDelegationTokenResponseProto getDelegationToken( RpcController controller, GetDelegationTokenRequestProto proto) throws ServiceException { GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto); try { GetDelegationTokenResponse response = real.getDelegationToken(request); return ((GetDelegationTokenResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetDelegationTokenResponse getDelegationToken( GetDelegationTokenRequest request) throws IOException { GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl) request).getProto(); try { return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken( null, requestProto)); } catch (ServiceException e) { throw unwrapAndThrowException(e); } }
@Override public void setRenewer(String renewer) { maybeInitBuilder(); if (renewer == null) builder.clearRenewer(); this.renewer = renewer; }
@Override public GetDelegationTokenResponseProto getDelegationToken( RpcController controller, GetDelegationTokenRequestProto proto) throws ServiceException { GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto); try { GetDelegationTokenResponse response = real.getDelegationToken(request); return ((GetDelegationTokenResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetDelegationTokenResponse getDelegationToken( GetDelegationTokenRequest request) throws IOException { GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl) request).getProto(); try { return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken( null, requestProto)); } catch (ServiceException e) { throw unwrapAndThrowException(e); } }
@Override public void setRenewer(String renewer) { maybeInitBuilder(); if (renewer == null) builder.clearRenewer(); this.renewer = renewer; }
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public GetDelegationTokenResponseProto getDelegationToken( RpcController controller, GetDelegationTokenRequestProto proto) throws ServiceException { GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto); try { GetDelegationTokenResponse response = real.getDelegationToken(request); return ((GetDelegationTokenResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetDelegationTokenResponse getDelegationToken( GetDelegationTokenRequest request) throws IOException { GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl) request).getProto(); try { return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken( null, requestProto)); } catch (ServiceException e) { throw unwrapAndThrowException(e); } }
@Override public GetDelegationTokenRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
@Override public void setRenewer(String renewer) { maybeInitBuilder(); if (renewer == null) builder.clearRenewer(); this.renewer = renewer; }
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
@Override public GetDelegationTokenResponseProto getDelegationToken( RpcController controller, GetDelegationTokenRequestProto proto) throws ServiceException { GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto); try { GetDelegationTokenResponse response = real.getDelegationToken(request); return ((GetDelegationTokenResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetDelegationTokenResponse getDelegationToken( GetDelegationTokenRequest request) throws IOException { GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl) request).getProto(); try { return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken( null, requestProto)); } catch (ServiceException e) { throw unwrapAndThrowException(e); } }
@Override public GetDelegationTokenRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
@Override public void setRenewer(String renewer) { maybeInitBuilder(); if (renewer == null) builder.clearRenewer(); this.renewer = renewer; }
private void mergeLocalToProto() { if (viaProto) maybeInitBuilder(); mergeLocalToBuilder(); proto = builder.build(); viaProto = true; }
/** * Gets a JHS delegation token and stores it in the given Credentials. * * @return the same Credentials instance as the one given in parameter. */ public static Credentials obtainToken(Configuration configuration, Credentials credentials) { if (!UserGroupInformation.isSecurityEnabled()) { return credentials; } String historyServerAddress = configuration.get("mapreduce.jobhistory.address"); HostAndPort hostAndPort = HostAndPort.fromString(historyServerAddress); try { ResourceMgrDelegate resourceMgrDelegate = new ResourceMgrDelegate(new YarnConfiguration(configuration)); MRClientCache clientCache = new MRClientCache(configuration, resourceMgrDelegate); MRClientProtocol hsProxy = clientCache.getInitializedHSProxy(); GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(); request.setRenewer(YarnUtils.getYarnTokenRenewer(configuration)); InetSocketAddress address = new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort()); Token<TokenIdentifier> token = ConverterUtils.convertFromYarn(hsProxy.getDelegationToken(request).getDelegationToken(), address); credentials.addToken(new Text(token.getService()), token); LOG.debug("Adding JobHistoryServer delegation token {}.", token); return credentials; } catch (Exception e) { throw Throwables.propagate(e); } }