You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2012/12/13 19:22:04 UTC
svn commit: r1421416 - in /accumulo/trunk/core/src:
main/java/org/apache/accumulo/core/util/ContextFactory.java
test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
Author: ctubbsii
Date: Thu Dec 13 18:22:00 2012
New Revision: 1421416
URL: http://svn.apache.org/viewvc?rev=1421416&view=rev
Log:
ACCUMULO-467, ACCUMULO-769 Partially revert edits that cause strange compilation errors on the build server, and remove createJob() from the ContextFactory, as it isn't needed.
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ContextFactory.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ContextFactory.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ContextFactory.java?rev=1421416&r1=1421415&r2=1421416&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ContextFactory.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ContextFactory.java Thu Dec 13 18:22:00 2012
@@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTarge
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.MapContext;
@@ -41,7 +40,6 @@ import org.apache.hadoop.mapreduce.TaskA
*/
public class ContextFactory {
- private static final Constructor<?> JOB_CONSTRUCTOR;
private static final Constructor<?> JOB_CONTEXT_CONSTRUCTOR;
private static final Constructor<?> TASK_CONTEXT_CONSTRUCTOR;
private static final Constructor<?> TASK_ID_CONSTRUCTOR;
@@ -60,7 +58,6 @@ public class ContextFactory {
v21 = false;
}
useV21 = v21;
- Class<?> jobCls;
Class<?> jobContextCls;
Class<?> taskContextCls;
Class<?> mapCls;
@@ -68,7 +65,6 @@ public class ContextFactory {
Class<?> innerMapContextCls;
try {
if (v21) {
- jobCls = Class.forName(PACKAGE + ".Job");
jobContextCls = Class.forName(PACKAGE + ".task.JobContextImpl");
taskContextCls = Class.forName(PACKAGE + ".task.TaskAttemptContextImpl");
TASK_TYPE_CLASS = Class.forName(PACKAGE + ".TaskType");
@@ -76,7 +72,6 @@ public class ContextFactory {
mapCls = Class.forName(PACKAGE + ".lib.map.WrappedMapper");
innerMapContextCls = Class.forName(PACKAGE + ".lib.map.WrappedMapper$Context");
} else {
- jobCls = Class.forName(PACKAGE + ".Job");
jobContextCls = Class.forName(PACKAGE + ".JobContext");
taskContextCls = Class.forName(PACKAGE + ".TaskAttemptContext");
TASK_TYPE_CLASS = null;
@@ -88,7 +83,6 @@ public class ContextFactory {
throw new IllegalArgumentException("Can't find class", e);
}
try {
- JOB_CONSTRUCTOR = jobCls.getConstructor(Configuration.class, String.class);
JOB_CONTEXT_CONSTRUCTOR = jobContextCls.getConstructor(Configuration.class, JobID.class);
JOB_CONTEXT_CONSTRUCTOR.setAccessible(true);
TASK_CONTEXT_CONSTRUCTOR = taskContextCls.getConstructor(Configuration.class, TaskAttemptID.class);
@@ -117,22 +111,6 @@ public class ContextFactory {
}
}
- public static Job createJob() {
- return createJob(new Configuration());
- }
-
- public static Job createJob(Configuration conf) {
- try {
- return (Job) JOB_CONSTRUCTOR.newInstance(conf, new JobID("local", 0).toString());
- } catch (InstantiationException e) {
- throw new IllegalArgumentException("Can't create object", e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException("Can't create object", e);
- } catch (InvocationTargetException e) {
- throw new IllegalArgumentException("Can't create object", e);
- }
- }
-
public static JobContext createJobContext() {
return createJobContext(new Configuration());
}
@@ -174,19 +152,16 @@ public class ContextFactory {
return createMapContext(m, tac, reader, writer, null, null, split);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static <K1,V1,K2,V2> Mapper<K1,V1,K2,V2>.Context createMapContext(Mapper<K1,V1,K2,V2> m, TaskAttemptContext tac, RecordReader<K1,V1> reader,
RecordWriter<K2,V2> writer, OutputCommitter committer, StatusReporter reporter, InputSplit split) {
try {
if (useV21) {
Object basis = MAP_CONTEXT_IMPL_CONSTRUCTOR.newInstance(tac.getConfiguration(), tac.getTaskAttemptID(), reader, writer, committer, reporter, split);
- @SuppressWarnings("unchecked")
- Mapper<K1,V1,K2,V2>.Context newInstance = (Mapper<K1,V1,K2,V2>.Context) MAP_CONTEXT_CONSTRUCTOR.newInstance(MAP_CONSTRUCTOR.newInstance(), basis);
- return newInstance;
+ return (Mapper.Context) MAP_CONTEXT_CONSTRUCTOR.newInstance((Mapper<K1,V1,K2,V2>) MAP_CONSTRUCTOR.newInstance(), basis);
} else {
- @SuppressWarnings("unchecked")
- Mapper<K1,V1,K2,V2>.Context newInstance = (Mapper<K1,V1,K2,V2>.Context) MAP_CONTEXT_CONSTRUCTOR.newInstance(m, tac.getConfiguration(),
- tac.getTaskAttemptID(), reader, writer, committer, reporter, split);
- return newInstance;
+ return (Mapper.Context) MAP_CONTEXT_CONSTRUCTOR.newInstance(m, tac.getConfiguration(), tac.getTaskAttemptID(), reader, writer, committer, reporter,
+ split);
}
} catch (InstantiationException e) {
throw new IllegalArgumentException("Can't create object", e);
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java?rev=1421416&r1=1421415&r2=1421416&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java Thu Dec 13 18:22:00 2012
@@ -41,8 +41,8 @@ public class AccumuloFileOutputFormatTes
static Path f = null;
@Before
- public void setup() {
- job = ContextFactory.createJob();
+ public void setup() throws IOException {
+ job = new Job();
Path file = new Path("target/");
f = new Path(file, "_temporary");