use of org.apache.tez.runtime.library.common.combine.Combiner in project tez by apache.
the class TezRuntimeUtils method instantiateCombiner.
@SuppressWarnings("unchecked")
public static Combiner instantiateCombiner(Configuration conf, TaskContext taskContext) throws IOException {
Class<? extends Combiner> clazz;
String className = conf.get(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS);
if (className == null) {
return null;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Using Combiner class: " + className);
}
try {
clazz = (Class<? extends Combiner>) conf.getClassByName(className);
} catch (ClassNotFoundException e) {
throw new IOException("Unable to load combiner class: " + className);
}
Combiner combiner = null;
Constructor<? extends Combiner> ctor;
try {
ctor = clazz.getConstructor(TaskContext.class);
combiner = ctor.newInstance(taskContext);
} catch (SecurityException e) {
throw new IOException(e);
} catch (NoSuchMethodException e) {
throw new IOException(e);
} catch (IllegalArgumentException e) {
throw new IOException(e);
} catch (InstantiationException e) {
throw new IOException(e);
} catch (IllegalAccessException e) {
throw new IOException(e);
} catch (InvocationTargetException e) {
throw new IOException(e);
}
return combiner;
}
Aggregations