Example usage for org.apache.hadoop.security.token Token isManaged

List of usage examples for org.apache.hadoop.security.token Token isManaged

Introduction

In this page you can find the example usage for org.apache.hadoop.security.token Token isManaged.

Prototype

public boolean isManaged() throws IOException 

Source Link

Document

Is this token managed so that it can be renewed or cancelled?

Usage

From source file:org.apache.tez.engine.common.security.DelegationTokenRenewal.java

License:Apache License

public static synchronized void registerDelegationTokensForRenewal(ApplicationId jobId, Credentials ts,
        Configuration conf) throws IOException {
    if (ts == null)
        return; //nothing to add

    Collection<Token<?>> tokens = ts.getAllTokens();
    long now = System.currentTimeMillis();

    for (Token<?> t : tokens) {
        // first renew happens immediately
        if (t.isManaged()) {
            DelegationTokenToRenew dtr = new DelegationTokenToRenew(jobId, t, conf, now);

            addTokenToList(dtr);//from   w  w  w.  ja  v  a 2  s. c o m

            setTimerForTokenRenewal(dtr, true);
            LOG.info("registering token for renewal for service =" + t.getService() + " and jobID = " + jobId);
        }
    }
}