You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2012/03/12 21:47:52 UTC
svn commit: r1299848 -
/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java
Author: larsh
Date: Mon Mar 12 20:47:52 2012
New Revision: 1299848
URL: http://svn.apache.org/viewvc?rev=1299848&view=rev
Log:
Fixups to MultithreadedTableMapper for Hadoop 0.23.2+ (Andrew)
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java?rev=1299848&r1=1299847&r2=1299848&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/MultithreadedTableMapper.java Mon Mar 12 20:47:52 2012
@@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.mapreduce;
import java.io.IOException;
+import java.lang.reflect.Constructor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -221,6 +222,10 @@ public class MultithreadedTableMapper<K2
public void setStatus(String status) {
outer.setStatus(status);
}
+
+ public float getProgress() {
+ return 0;
+ }
}
private class MapRunner implements Runnable {
@@ -228,16 +233,32 @@ public class MultithreadedTableMapper<K2
private Context subcontext;
private Throwable throwable;
+ @SuppressWarnings({ "rawtypes", "unchecked" })
MapRunner(Context context) throws IOException, InterruptedException {
mapper = ReflectionUtils.newInstance(mapClass,
context.getConfiguration());
- subcontext = new Context(outer.getConfiguration(),
+ try {
+ Constructor c = context.getClass().getConstructor(
+ Configuration.class,
+ outer.getTaskAttemptID().getClass(),
+ SubMapRecordReader.class,
+ SubMapRecordWriter.class,
+ context.getOutputCommitter().getClass(),
+ SubMapStatusReporter.class,
+ outer.getInputSplit().getClass());
+ c.setAccessible(true);
+ subcontext = (Context) c.newInstance(
+ outer.getConfiguration(),
outer.getTaskAttemptID(),
new SubMapRecordReader(),
new SubMapRecordWriter(),
context.getOutputCommitter(),
new SubMapStatusReporter(),
outer.getInputSplit());
+ } catch (Exception e) {
+ // rethrow as IOE
+ throw new IOException(e);
+ }
}
@Override