/** * Creates a new {@link AlluxioMasterProcess}. * * @param rpcBindSocket the socket whose address the rpc server will eventually bind to * @param webBindSocket the socket whose address the web server will eventually bind to * @return a new instance of {@link MasterProcess} using the given sockets for the master */ public static AlluxioMasterProcess create(ServerSocket rpcBindSocket, ServerSocket webBindSocket) { URI journalLocation = JournalUtils.getJournalLocation(); JournalSystem journalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(); if (ServerConfiguration.getBoolean(PropertyKey.ZOOKEEPER_ENABLED)) { Preconditions.checkState(!(journalSystem instanceof RaftJournalSystem), "Raft journal cannot be used with Zookeeper enabled"); PrimarySelector primarySelector = PrimarySelector.Factory.createZkPrimarySelector(); return new FaultTolerantAlluxioMasterProcess(journalSystem, primarySelector, rpcBindSocket, webBindSocket); } else if (journalSystem instanceof RaftJournalSystem) { PrimarySelector primarySelector = ((RaftJournalSystem) journalSystem).getPrimarySelector(); return new FaultTolerantAlluxioMasterProcess(journalSystem, primarySelector, rpcBindSocket, webBindSocket); } return new AlluxioMasterProcess(journalSystem, rpcBindSocket, webBindSocket); }
/** * @return a new instance of {@link MasterProcess} */ public static MasterProcess create() { URI journalLocation = JournalUtils.getJournalLocation(); JournalSystem journalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(); if (Configuration.getBoolean(PropertyKey.ZOOKEEPER_ENABLED)) { PrimarySelector primarySelector = PrimarySelector.Factory.createZkPrimarySelector(); return new FaultTolerantAlluxioMasterProcess(journalSystem, primarySelector); } return new AlluxioMasterProcess(journalSystem); }