Example usage for org.apache.hadoop.mapred JobClient cancelDelegationToken

List of usage examples for org.apache.hadoop.mapred JobClient cancelDelegationToken

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred JobClient cancelDelegationToken.

Prototype

public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
        throws InvalidToken, IOException, InterruptedException 

Source Link

Document

Cancel a delegation token from the JobTracker

Usage

From source file:azkaban.security.HadoopSecurityManager_H_1_0.java

License:Apache License

private void cancelMRJobTrackerToken(final Token<? extends TokenIdentifier> t, String userToProxy)
        throws HadoopSecurityManagerException {
    try {/*w w  w.j a v  a 2 s  . c  om*/
        getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() {
            @SuppressWarnings("unchecked")
            @Override
            public Void run() throws Exception {
                cancelToken((Token<DelegationTokenIdentifier>) t);
                return null;
            }

            private void cancelToken(Token<DelegationTokenIdentifier> jt)
                    throws IOException, InterruptedException {
                JobConf jc = new JobConf(conf);
                JobClient jobClient = new JobClient(jc);
                jobClient.cancelDelegationToken(jt);
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        throw new HadoopSecurityManagerException("Failed to cancel Token. " + e.getMessage() + e.getCause());
    }
}

From source file:azkaban.security.HadoopSecurityManager_H_2_0.java

License:Apache License

private void cancelMRJobTrackerToken(final Token<? extends TokenIdentifier> t, String userToProxy)
        throws HadoopSecurityManagerException {
    try {//from  ww  w.j  ava2  s.c o m
        getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() {
            @SuppressWarnings("unchecked")
            @Override
            public Void run() throws Exception {
                cancelToken((Token<DelegationTokenIdentifier>) t);
                return null;
            }

            private void cancelToken(Token<DelegationTokenIdentifier> jt)
                    throws IOException, InterruptedException {
                JobConf jc = new JobConf(conf);
                JobClient jobClient = new JobClient(jc);
                jobClient.cancelDelegationToken(jt);
            }
        });
    } catch (Exception e) {
        throw new HadoopSecurityManagerException("Failed to cancel token. " + e.getMessage() + e.getCause(), e);
    }
}