Search in sources :

Example 1 with SecurityUtil

use of org.apache.hadoop.security.SecurityUtil in project tez by apache.

the class TezUtilsInternal method setSecurityUtilConfigration.

@Private
public static void setSecurityUtilConfigration(Logger log, Configuration conf) {
    // Use reflection to invoke SecurityUtil.setConfiguration when available, version 2.6.0 of
    // hadoop does not support it, it is currently available from 2.9.0.
    // Remove this when the minimum supported hadoop version has the above method.
    Class<SecurityUtil> clz = SecurityUtil.class;
    try {
        Method method = clz.getMethod("setConfiguration", Configuration.class);
        method.invoke(null, conf);
    } catch (NoSuchMethodException e) {
    // This is not available, so ignore it.
    } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        log.warn("Error invoking SecurityUtil.setConfiguration: ", e);
        throw new TezUncheckedException("Error invoking SecurityUtil.setConfiguration", e);
    }
}
Also used : TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) SecurityUtil(org.apache.hadoop.security.SecurityUtil) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Private (org.apache.hadoop.classification.InterfaceAudience.Private)1 SecurityUtil (org.apache.hadoop.security.SecurityUtil)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1