public void map(WritableComparable key, Writable value,
OutputCollector<WritableComparable, IntWritable> output,
Reporter reporter)
throws IOException {
//check for classpath
String classpath = System.getProperty("java.class.path");
if (classpath.indexOf("testjob.jar") == -1) {
throw new IOException("failed to find in the library " + classpath);
}
if (classpath.indexOf("test.jar") == -1) {
throw new IOException("failed to find the library test.jar in"
+ classpath);
}
//fork off ls to see if the file exists.
// java file.exists() will not work on
// Windows since it is a symlink
String[] argv = new String[7];
argv[0] = "ls";
argv[1] = "files_tmp";
argv[2] = "localfilelink";
argv[3] = "dfsfilelink";
argv[4] = "tarlink";
argv[5] = "ziplink";
argv[6] = "test.tgz";
Process p = Runtime.getRuntime().exec(argv);
int ret = -1;
try {
ret = p.waitFor();
} catch(InterruptedException ie) {
//do nothing here.
}
if (ret != 0) {
throw new IOException("files_tmp does not exist");
}
}
ExternalMapReduce.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:hadoop
作者:
评论列表
文章目录