Source:
void doMain(String[] args, Configuration conf) { if (args.length < 1) { printUsage(); return; } Injector injector = Guice.createInjector( new ConfigModule(conf), new ZKModule(), new DiscoveryModules().getDistributedModules(), new TransactionModules().getDistributedModules(), new TransactionClientModule() ); ZKClientService zkClient = injector.getInstance(ZKClientService.class); zkClient.startAndWait(); try { TransactionSystemClient txClient = injector.getInstance(TransactionSystemClient.class); String option = args[0]; if (option.equals(OPT_TRUNCATE_INVALID_TX)) { if (args.length != 2) { printUsage(); return; } Set<Long> txIds = parseTxIds(args[1]); if (!txIds.isEmpty()) { out.println("Invalid list size before truncation: " + txClient.getInvalidSize()); txClient.truncateInvalidTx(txIds); out.println("Invalid list size after truncation: " + txClient.getInvalidSize()); } } else if (option.equals(OPT_TRUNCATE_INVALID_TX_BEFORE)) { if (args.length != 2) { printUsage(); return; } try { long time = Long.parseLong(args[1]); out.println("Invalid list size before truncation: " + txClient.getInvalidSize()); txClient.truncateInvalidTxBefore(time); out.println("Invalid list size after truncation: " + txClient.getInvalidSize()); } catch (InvalidTruncateTimeException e) { err.println(e.getMessage()); } catch (NumberFormatException e) { err.println("NumberFormatException: " + e.getMessage()); } } else if (option.equals(OPT_GET_INVALID_TX_SIZE)) { if (args.length != 1) { printUsage(); return; } out.println("Invalid list size: " + txClient.getInvalidSize()); } else { printUsage(); } } finally { zkClient.stopAndWait(); } }

Target:
int doMain(String[] args, Configuration conf) { if (args.length < 1) { printUsage(); return 1; } Injector injector = Guice.createInjector( new ConfigModule(conf), new ZKModule(), new DiscoveryModules().getDistributedModules(), new TransactionModules().getDistributedModules(), new TransactionClientModule() ); ZKClientService zkClient = injector.getInstance(ZKClientService.class); zkClient.startAndWait(); try { TransactionSystemClient txClient = injector.getInstance(TransactionSystemClient.class); String option = args[0]; if (option.equals(OPT_TRUNCATE_INVALID_TX)) { if (args.length != 2) { printUsage(); return 1; } Set<Long> txIds; try { txIds = parseTxIds(args[1]); } catch (NumberFormatException e) { err.println("NumberFormatException: " + e.getMessage()); return 1; } if (!txIds.isEmpty()) { out.println("Invalid list size before truncation: " + txClient.getInvalidSize()); txClient.truncateInvalidTx(txIds); out.println("Invalid list size after truncation: " + txClient.getInvalidSize()); } } else if (option.equals(OPT_TRUNCATE_INVALID_TX_BEFORE)) { if (args.length != 2) { printUsage(); return 1; } try { long time = Long.parseLong(args[1]); out.println("Invalid list size before truncation: " + txClient.getInvalidSize()); txClient.truncateInvalidTxBefore(time); out.println("Invalid list size after truncation: " + txClient.getInvalidSize()); } catch (InvalidTruncateTimeException e) { err.println(e.getMessage()); return 1; } catch (NumberFormatException e) { err.println("NumberFormatException: " + e.getMessage()); return 1; } } else if (option.equals(OPT_GET_INVALID_TX_SIZE)) { if (args.length != 1) { printUsage(); return 1; } out.println("Invalid list size: " + txClient.getInvalidSize()); } else { printUsage(); return 1; } } finally { zkClient.stopAndWait(); } return 0; }