org.apache.hadoop.mapreduce
Class ContextFactory
java.lang.Object
org.apache.hadoop.mapreduce.ContextFactory
public class ContextFactory
- extends Object
A factory to allow applications to deal with inconsistencies between
MapReduce Context Objects API between hadoop-0.20 and later versions.
Method Summary |
static JobContext |
cloneContext(JobContext original,
org.apache.hadoop.conf.Configuration conf)
Clone a JobContext or TaskAttemptContext with a
new configuration. |
static
|
cloneMapContext(MapContext<K1,V1,K2,V2> context,
org.apache.hadoop.conf.Configuration conf,
RecordReader<K1,V1> reader,
RecordWriter<K2,V2> writer)
Copy a custom WrappedMapper.Context, optionally replacing
the input and output. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextFactory
public ContextFactory()
cloneContext
public static JobContext cloneContext(JobContext original,
org.apache.hadoop.conf.Configuration conf)
throws IOException,
InterruptedException
- Clone a
JobContext
or TaskAttemptContext
with a
new configuration.
- Parameters:
original
- the original contextconf
- the new configuration
- Returns:
- a new context object
- Throws:
InterruptedException
IOException
cloneMapContext
public static <K1,V1,K2,V2> Mapper.Context cloneMapContext(MapContext<K1,V1,K2,V2> context,
org.apache.hadoop.conf.Configuration conf,
RecordReader<K1,V1> reader,
RecordWriter<K2,V2> writer)
throws IOException,
InterruptedException
- Copy a custom WrappedMapper.Context, optionally replacing
the input and output.
- Type Parameters:
K1
- input key typeV1
- input value typeK2
- output key typeV2
- output value type- Parameters:
context
- the context to cloneconf
- a new configurationreader
- Reader to read from. Null means to clone from context.writer
- Writer to write to. Null means to clone from context.
- Returns:
- a new context. it will not be the same class as the original.
- Throws:
IOException
InterruptedException
Copyright © 2013 Apache Software Foundation. All Rights Reserved.