Source:
public void execute() throws Exception { File tempDir = new File(FileUtils.getTempDirectory(), String.valueOf(System.currentTimeMillis())); Preconditions.checkState(tempDir.mkdirs()); QuickstartTableRequest request = new QuickstartTableRequest(_tableDirectory.getAbsolutePath()); final QuickstartRunner runner = new QuickstartRunner(Lists.newArrayList(request), 1, 1, 1, tempDir); printStatus(Color.CYAN, "***** Starting Kafka *****"); startKafka(); printStatus(Color.CYAN, "***** Starting zookeeper, controller, server and broker *****"); runner.startAll(); printStatus(Color.CYAN, "***** Adding table *****"); runner.bootstrapTable(); printStatus(Color.CYAN, "***** Waiting for 10 seconds for a few events to get populated *****"); Thread.sleep(10000); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { printStatus(Color.GREEN, "***** Shutting down GenericQuickStart *****"); runner.stop(); _kafkaStarter.stop(); ZkStarter.stopLocalZkServer(_zookeeperInstance); } catch (Exception e) { LOGGER.error("Caught exception in shutting down GenericQuickStart QuickStart", e); } })); printStatus(Color.YELLOW, "***** GenericQuickStart demo quickstart setup complete *****"); String q1 = "select count(*) from starbucksStores limit 0"; printStatus(Color.YELLOW, "Total number of documents in the table"); printStatus(Color.CYAN, "Query : " + q1); printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q1))); printStatus(Color.GREEN, "***************************************************"); printStatus(Color.GREEN, "You can always go to http://localhost:9000 to play around in the query console"); }

Target:
public void execute() throws Exception { File tempDir = new File(FileUtils.getTempDirectory(), String.valueOf(System.currentTimeMillis())); Preconditions.checkState(tempDir.mkdirs()); QuickstartTableRequest request = new QuickstartTableRequest(_tableDirectory.getAbsolutePath()); final QuickstartRunner runner = new QuickstartRunner(Lists.newArrayList(request), 1, 1, 1, tempDir); printStatus(Color.CYAN, "***** Starting Kafka *****"); startKafka(); printStatus(Color.CYAN, "***** Starting zookeeper, controller, server and broker *****"); runner.startAll(); printStatus(Color.CYAN, "***** Adding table *****"); runner.bootstrapTable(); printStatus(Color.CYAN, "***** Waiting for 10 seconds for a few events to get populated *****"); Thread.sleep(10000); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { printStatus(Color.GREEN, "***** Shutting down QuickStart cluster *****"); runner.stop(); _kafkaStarter.stop(); ZkStarter.stopLocalZkServer(_zookeeperInstance); } catch (Exception e) { LOGGER.error("Caught exception in shutting down QuickStart cluster", e); } })); printStatus(Color.YELLOW, "***** GenericQuickStart demo quickstart setup complete *****"); String q1 = "select count(*) from starbucksStores limit 0"; printStatus(Color.YELLOW, "Total number of documents in the table"); printStatus(Color.CYAN, "Query : " + q1); printStatus(Color.YELLOW, prettyPrintResponse(runner.runQuery(q1))); printStatus(Color.GREEN, "***************************************************"); printStatus(Color.GREEN, "You can always go to http://localhost:9000 to play around in the query console"); }