Example usage for org.apache.hadoop.yarn.client ClientRMProxy getAMRMTokenService

List of usage examples for org.apache.hadoop.yarn.client ClientRMProxy getAMRMTokenService

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.client ClientRMProxy getAMRMTokenService.

Prototype

@Unstable
    public static Text getAMRMTokenService(Configuration conf) 

Source Link

Usage

From source file:disAMS.AMRMClient.Impl.AMRMClientImpl.java

License:Apache License

private void updateAMRMToken(Token token) throws IOException {
    org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken = new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(
            token.getIdentifier().array(), token.getPassword().array(), new Text(token.getKind()),
            new Text(token.getService()));
    // Preserve the token service sent by the RM when adding the token
    // to ensure we replace the previous token setup by the RM.
    // Afterwards we can update the service address for the RPC layer.
    UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
    currentUGI.addToken(amrmToken);/*  w ww  . ja  va 2  s  .c  o  m*/
    amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}