use of org.apache.zookeeper.server.ExitCode in project zookeeper by apache.
the class LogChopper method main.
public static void main(String[] args) {
ExitCode rc = ExitCode.INVALID_INVOCATION;
if (args.length != 3) {
System.out.println("Usage: LogChopper zxid_to_chop_to txn_log_to_chop chopped_filename");
System.out.println(" this program will read the txn_log_to_chop file and copy all the transactions");
System.out.println(" from it up to (and including) the given zxid into chopped_filename.");
ServiceUtils.requestSystemExit(rc.getValue());
}
String txnLog = args[1];
String choppedLog = args[2];
try (InputStream is = new BufferedInputStream(new FileInputStream(txnLog));
OutputStream os = new BufferedOutputStream(new FileOutputStream(choppedLog))) {
long zxid = Long.decode(args[0]);
if (chop(is, os, zxid)) {
rc = ExitCode.EXECUTION_FINISHED;
}
} catch (Exception e) {
System.out.println("Got exception: " + e.getMessage());
}
ServiceUtils.requestSystemExit(rc.getValue());
}
Aggregations