Entry point to run the search utility @param args Command line arguments @throws Exception If something goes wrong
(String[] args)
| 51 | * @throws Exception If something goes wrong |
| 52 | */ |
| 53 | public static void main(String[] args) throws Exception { |
| 54 | ArgP argp = new ArgP(); |
| 55 | CliOptions.addCommon(argp); |
| 56 | argp.addOption("--use-data-table", |
| 57 | "Scan against the raw data table instead of the meta data table."); |
| 58 | args = CliOptions.parse(argp, args); |
| 59 | if (args == null) { |
| 60 | usage(argp, "Invalid usage"); |
| 61 | System.exit(2); |
| 62 | } else if (args.length < 1) { |
| 63 | usage(argp, "Not enough arguments"); |
| 64 | System.exit(2); |
| 65 | } |
| 66 | |
| 67 | final boolean use_data_table = argp.has("--use-data-table"); |
| 68 | |
| 69 | Config config = CliOptions.getConfig(argp); |
| 70 | final TSDB tsdb = new TSDB(config); |
| 71 | tsdb.checkNecessaryTablesExist().joinUninterruptibly(); |
| 72 | |
| 73 | int rc; |
| 74 | try { |
| 75 | rc = runCommand(tsdb, use_data_table, args); |
| 76 | } finally { |
| 77 | try { |
| 78 | tsdb.getClient().shutdown().joinUninterruptibly(); |
| 79 | LOG.info("Gracefully shutdown the TSD"); |
| 80 | } catch (Exception e) { |
| 81 | LOG.error("Unexpected exception while shutting down", e); |
| 82 | rc = 42; |
| 83 | } |
| 84 | } |
| 85 | System.exit(rc); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Determines the command requested of the user can calls the appropriate |
nothing calls this directly
no test coverage detected