-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHassandra.java
executable file
·46 lines (37 loc) · 1.22 KB
/
Hassandra.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.example;
import org.apache.commons.lang.time.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.util.ToolRunner;
import com.example.mapreduce.CassandraMapRed;
import com.example.mapreduce.HDFSMapRed;
public class Hassandra {
private static final Log log = LogFactory.getLog(Hassandra.class);
private static final String HDFS = "hdfs";
private static final String CASSANDRA = "cassandra";
/**
* @param args
*/
public static void main(String[] args) {
Hassandra h = new Hassandra();
System.exit(h.run(args));
}
public int run(String[] args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
int status = -1;
try {
if (args[0].equals(HDFS)) {
status = ToolRunner.run(new HDFSMapRed(), args);
} else if (args[0].equals(CASSANDRA)) {
status = ToolRunner.run(new CassandraMapRed(), args);
}
} catch (Exception e) {
e.printStackTrace();
return -1;
}
stopWatch.stop();
log.info("response time: " + stopWatch.getTime());
return status;
}
}