public static void main(String[] args) throws UnknownHostException { if (args.length > 1) { LOG.info( "Usage: java -cp target/tachyon-" + Version.VERSION + "-jar-with-dependencies.jar " + "tachyon.Worker [<MasterHost:Port>]"); System.exit(-1); } WorkerConf wConf = WorkerConf.get(); String resolvedWorkerHost = NetworkUtils.getLocalHostName(); LOG.info("Resolved local TachyonWorker host to " + resolvedWorkerHost); TachyonWorker worker = TachyonWorker.createWorker( getMasterLocation(args), resolvedWorkerHost + ":" + wConf.PORT, wConf.DATA_PORT, wConf.SELECTOR_THREADS, wConf.QUEUE_SIZE_PER_SELECTOR, wConf.SERVER_THREADS, wConf.DATA_FOLDER, wConf.MEMORY_SIZE); try { worker.start(); } catch (Exception e) { LOG.error("Uncaught exception terminating worker", e); throw new RuntimeException(e); } }
/** * Main method for Tachyon Worker. A Block Worker will be started and the Tachyon Worker will * continue to run until the Block Worker thread exits. * * @param args command line arguments, should be empty */ public static void main(String[] args) { checkArgs(args); TachyonWorker worker = new TachyonWorker(); try { worker.start(); } catch (Exception e) { LOG.error("Uncaught exception while running worker, stopping it and exiting.", e); try { worker.stop(); } catch (Exception ex) { // continue to exit LOG.error("Uncaught exception while stopping worker, simply exiting.", ex); } System.exit(-1); } }