Example usage for org.apache.hadoop.yarn.api ApplicationClientProtocol getDelegationToken

List of usage examples for org.apache.hadoop.yarn.api ApplicationClientProtocol getDelegationToken

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api ApplicationClientProtocol getDelegationToken.

Prototype

@Public
@Stable
@Idempotent
public GetDelegationTokenResponse getDelegationToken(GetDelegationTokenRequest request)
        throws YarnException, IOException;

Source Link

Document

The interface used by clients to get delegation token, enabling the containers to be able to talk to the service using those tokens.

Usage

From source file:org.springframework.yarn.client.ClientRmTemplate.java

License:Apache License

@Override
public Token getDelegationToken(final String renewer) {
    return execute(new YarnRpcCallback<Token, ApplicationClientProtocol>() {
        @Override//from w  w  w  .jav a 2 s  .c  om
        public Token doInYarn(ApplicationClientProtocol proxy) throws YarnException, IOException {
            GetDelegationTokenRequest request = Records.newRecord(GetDelegationTokenRequest.class);
            request.setRenewer(renewer);
            return proxy.getDelegationToken(request).getRMDelegationToken();
        }
    });
}