Job.class
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class Job extends JobContextImpl implements JobContext {
省略1000多行代码。。。
public boolean waitForCompletion(boolean verbose )
throws IOException, InterruptedException,lassNotFoundException {
方法体。。。。
}
}
waitForCompletion(){}
/**
* Submit the job to the cluster and wait for it to finish.
* @param verbose print the progress to the user
* @return true if the job succeeded
* @throws IOException thrown if the communication with the
* <code>JobTracker</code> is lost
*/
public boolean waitForCompletion(boolean verbose
) throws IOException, InterruptedException,
ClassNotFoundException {
if (state == JobState.DEFINE) {
submit();
}
if (verbose) {
monitorAndPrintJob();
} else {
// get the completion poll interval from the client.
int completionPollIntervalMillis =
Job.getCompletionPollInterval(cluster.getConf());
while (!isComplete()) {
try {
Thread.sleep(completionPollIntervalMillis);
} catch (InterruptedException ie) {
}
}
}
return isSuccessful();
}
JobContextImpl.class
@InterfaceAudience.Private
@InterfaceStability.Unstable
public class JobContextImpl implements JobContext {
类体。。。
}
MRJobConfig .class 顶级接口 定义各种常量
@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface MRJobConfig {
//定义了800多行常量
public static final String MAP_CLASS_ATTR = "mapreduce.job.map.class";
//The amount of memory to request from the scheduler for each map task.
public static final String MAP_MEMORY_MB = "mapreduce.map.memory.mb";
public static final int DEFAULT_MAP_MEMORY_MB = 1024;
方法体。。。
}
JobConf.class
public class JobConf extends Configuration {
}
/**
* Set the {@link Mapper} for the job.
* @param cls the <code>Mapper</code> to use
* @throws IllegalStateException if the job is submitted
*/
public void setMapperClass(Class<? extends Mapper> cls
) throws IllegalStateException {
ensureState(JobState.DEFINE);
conf.setClass(MAP_CLASS_ATTR, cls, Mapper.class);
}
/**
* Set the value of the <code>name</code> property to the name of a
* <code>theClass</code> implementing the given interface <code>xface</code>.
*
* An exception is thrown if <code>theClass</code> does not implement the
* interface <code>xface</code>.
*
* @param name property name.
* @param theClass property value.
* @param xface the interface implemented by the named class.
*/
public void setClass(String name, Class<?> theClass, Class<?> xface) {
if (!xface.isAssignableFrom(theClass))
throw new RuntimeException(theClass+" not "+xface.getName());
set(name, theClass.getName());
}