private synchronized Master createMaster ( int i ) throws IOException { Preconditions . checkState ( mState == State . STARTED , "Must be in a started state to create masters" ) ; MasterNetAddress address = mMasterAddresses . get ( i ) ; File confDir = new File ( mWorkDir , "conf-master" + i ) ; File metastoreDir = new File ( mWorkDir , "metastore-master" + i ) ; File logsDir = new File ( mWorkDir , "logs-master" + i ) ; logsDir . mkdirs ( ) ; Map < PropertyKey , String > conf = new HashMap <> ( ) ; conf . put ( PropertyKey . LOGGER_TYPE , "MASTER_LOGGER" ) ; conf . put ( PropertyKey . CONF_DIR , confDir . getAbsolutePath ( ) ) ; conf . put ( PropertyKey . MASTER_METASTORE_DIR , metastoreDir . getAbsolutePath ( ) ) ; conf . put ( PropertyKey . LOGS_DIR , logsDir . getAbsolutePath ( ) ) ; conf . put ( PropertyKey . MASTER_HOSTNAME , address . getHostname ( ) ) ; conf . put ( PropertyKey . MASTER_RPC_PORT , Integer . toString ( address . getRpcPort ( ) ) ) ; conf . put ( PropertyKey . MASTER_WEB_PORT , Integer . toString ( address . getWebPort ( ) ) ) ; conf . put ( PropertyKey . MASTER_EMBEDDED_JOURNAL_PORT , Integer . toString ( address . getEmbeddedJournalPort ( ) ) ) ; if ( mDeployMode . equals ( DeployMode . EMBEDDED ) ) { File journalDir = new File ( mWorkDir , "journal" + i ) ; journalDir . mkdirs ( ) ; conf . put ( PropertyKey . MASTER_JOURNAL_FOLDER , journalDir . getAbsolutePath ( ) ) ; } Master master = mCloser . register ( new Master ( logsDir , conf ) ) ; mMasters . add ( master ) ; return master ; }
Creates the specified master without starting it .