org.apache.hadoop.mapreduce
Class ContextFactory

java.lang.Object
  extended by org.apache.hadoop.mapreduce.ContextFactory

public class ContextFactory
extends java.lang.Object

A factory to allow applications to deal with inconsistencies between MapReduce Context Objects API between hadoop-0.20 and later versions.


Constructor Summary
ContextFactory()
           
 
Method Summary
static JobContext cloneContext(JobContext original, org.apache.hadoop.conf.Configuration conf)
          Clone a JobContext or TaskAttemptContext with a new configuration.
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)
          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
 

Constructor Detail

ContextFactory

public ContextFactory()
Method Detail

cloneContext

public static JobContext cloneContext(JobContext original,
                                      org.apache.hadoop.conf.Configuration conf)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
Clone a JobContext or TaskAttemptContext with a new configuration.

Parameters:
original - the original context
conf - the new configuration
Returns:
a new context object
Throws:
java.lang.InterruptedException
java.io.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 java.io.IOException,
                                             java.lang.InterruptedException
Copy a custom WrappedMapper.Context, optionally replacing the input and output.

Type Parameters:
K1 - input key type
V1 - input value type
K2 - output key type
V2 - output value type
Parameters:
context - the context to clone
conf - a new configuration
reader - 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:
java.io.IOException
java.lang.InterruptedException


Copyright © 2009 The Apache Software Foundation