use of org.talend.webhcat.launcher.fs.FileSystem in project tdi-studio-se by Talend.
the class Job method execute.
public Integer execute() throws IOException, InterruptedException, InvalidKeyException, URISyntaxException, StorageException {
String status = this.statusFolder;
String exitCode = status + "/exit";
final String stderr = status + "/stderr";
final FileSystem fs = this.fileSystem;
class StreamStrErr implements Runnable {
public void run() {
InputStream is = null;
BufferedReader d = null;
try {
while (!fs.exists(stderr)) {
Thread.sleep(2000);
}
is = fs.open(stderr);
d = new BufferedReader(new InputStreamReader(is));
String s;
while ((s = d.readLine()) == null) {
if (is != null) {
is.close();
}
if (d != null) {
d.close();
}
is = fs.open(stderr);
d = new BufferedReader(new InputStreamReader(is));
}
do {
System.err.println(s);
} while ((s = d.readLine()) != null);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
}
}
if (d != null) {
try {
d.close();
} catch (IOException e) {
}
}
}
}
}
StreamStrErr stream = new StreamStrErr();
stream.run();
while (!fs.exists(exitCode)) {
Thread.sleep(2000);
}
InputStream is = fs.open(exitCode);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String r = br.readLine();
try {
return Integer.parseInt(r);
} catch (Exception e) {
return 1;
}
}
use of org.talend.webhcat.launcher.fs.FileSystem in project tdi-studio-se by Talend.
the class MapReduceJob method main.
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("fs.default.name", "hdfs://hdp21:8020/");
FileSystem fs = new HadoopFileSystem(conf);
Job J = new MapReduceJob(fs);
J.parseArg(args);
J.callWS(J.sendFiles(), false);
J.execute();
}
Aggregations