in src/main/java/com/hadoop/compression/lzo/util/CompatibilityUtil.java [31:73]
static {
boolean v2 = true;
try {
// use the presence of JobContextImpl as a test for 2.x
Class.forName("org.apache.hadoop.mapreduce.task.JobContextImpl");
} catch (ClassNotFoundException cnfe) {
v2 = false;
}
useV2 = v2;
try {
Class<?> taskAttemptContextCls =
Class.forName(useV2 ?
PACKAGE + ".task.TaskAttemptContextImpl" :
PACKAGE + ".TaskAttemptContext");
TASK_ATTEMPT_CONTEXT_CONSTRUCTOR =
taskAttemptContextCls.getConstructor(Configuration.class,
TaskAttemptID.class);
GET_CONFIGURATION = getMethod(".JobContext", "getConfiguration");
INCREMENT_COUNTER_METHOD = getMethod(".Counter", "increment", Long.TYPE);
GET_COUNTER_VALUE_METHOD = getMethod(".Counter", "getValue");
if (useV2) {
Method get_counter;
try {
get_counter = getMethod(".TaskAttemptContext", "getCounter", Enum.class);
} catch (Exception e) {
get_counter = getMethod(".TaskInputOutputContext", "getCounter", Enum.class);
}
GET_COUNTER_ENUM_METHOD = get_counter;
} else {
GET_COUNTER_ENUM_METHOD = getMethod(".TaskInputOutputContext", "getCounter", Enum.class);
}
} catch (SecurityException e) {
throw new IllegalArgumentException("Can't run constructor ", e);
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException("Can't find constructor ", e);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Can't find class", e);
}
}