/** * Runs a master. * * @throws IOException if an I/O error occurs * @throws ConnectionFailedException if network connection failed */ private void startMaster() throws IOException, ConnectionFailedException { if (mRpcBindSocket != null && mWebBindSocket != null) { mMaster = AlluxioJobMasterProcess.Factory.create(mRpcBindSocket, mWebBindSocket); } else { mMaster = AlluxioJobMasterProcess.Factory.create(); } ServerConfiguration .set(PropertyKey.JOB_MASTER_RPC_PORT, String.valueOf(mMaster.getRpcAddress().getPort())); Runnable runMaster = new Runnable() { @Override public void run() { try { mMaster.start(); } catch (Exception e) { throw new RuntimeException(e + " \n Start Master Error \n" + e.getMessage(), e); } } }; mMasterThread = new Thread(runMaster); mMasterThread.start(); }
/** * Starts the Alluxio job master. * * @param args command line arguments, should be empty */ public static void main(String[] args) { if (args.length != 0) { LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioJobMaster.class.getCanonicalName()); System.exit(-1); } CommonUtils.PROCESS_TYPE.set(alluxio.util.CommonUtils.ProcessType.JOB_MASTER); AlluxioJobMasterProcess process; try { process = AlluxioJobMasterProcess.Factory.create(); } catch (Throwable t) { LOG.error("Failed to create job master process", t); // Exit to stop any non-daemon threads. System.exit(-1); throw t; } ProcessUtils.run(process); }
public static AlluxioJobMasterProcess create() { return create(MasterProcess.setupBindSocket(ServiceType.JOB_MASTER_RPC), MasterProcess.setupBindSocket(ServiceType.JOB_MASTER_WEB)); }