}
if (args.length == 3 && "commit".equalsIgnoreCase(args[2])) {
// Then, master commits if everything goes well.
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(args[1])));
WriterContext cntxt = (WriterContext) ois.readObject();
commit(config, true, cntxt);
System.exit(0);
}
// This piece of code runs in master node and gets necessary context.
WriterContext cntxt = runsInMaster(config);
// Master node will serialize writercontext and will make it available at slaves.
File f = new File(args[1]);
f.delete();