AlluxioJobMasterProcess(JournalSystem journalSystem, ServerSocket rpcBindSocket, ServerSocket webBindSocket) { super(journalSystem, rpcBindSocket, webBindSocket); mRpcConnectAddress = NetworkAddressUtils.getConnectAddress(ServiceType.JOB_MASTER_RPC, ServerConfiguration.global()); if (!ServerConfiguration.isSet(PropertyKey.JOB_MASTER_HOSTNAME)) { ServerConfiguration.set(PropertyKey.JOB_MASTER_HOSTNAME, NetworkAddressUtils.getLocalHostName( (int) ServerConfiguration.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS))); } mUfsManager = new JobUfsManager(); try { // Create master. mJobMaster = new JobMaster(new MasterContext(mJournalSystem), mUfsManager); } catch (Exception e) { LOG.error(e.getMessage(), e); throw Throwables.propagate(e); } }
@Before public void before() throws Exception { // Can't use ConfigurationRule due to conflicts with PowerMock. ServerConfiguration.set(PropertyKey.JOB_MASTER_JOB_CAPACITY, TEST_JOB_MASTER_JOB_CAPACITY); mJobMaster = new JobMaster(new MasterContext(new NoopJournalSystem()), Mockito.mock(UfsManager.class)); mJobMaster.start(true); }
/** * Creates a {@link AlluxioSecondaryMaster}. */ AlluxioSecondaryMaster() { try { URI journalLocation = JournalUtils.getJournalLocation(); mJournalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(); mRegistry = new MasterRegistry(); mSafeModeManager = new DefaultSafeModeManager(); mBackupManager = new BackupManager(mRegistry); mStartTimeMs = System.currentTimeMillis(); mPort = Configuration.getInt(PropertyKey.MASTER_RPC_PORT); // Create masters. MasterUtils.createMasters(mRegistry, new MasterContext(mJournalSystem, mSafeModeManager, mBackupManager, mStartTimeMs, mPort)); // Check that journals of each service have been formatted. if (!mJournalSystem.isFormatted()) { throw new RuntimeException( String.format("Journal %s has not been formatted!", journalLocation)); } mLatch = new CountDownLatch(1); } catch (IOException e) { throw new RuntimeException(e); } }
mBackupManager = new BackupManager(mRegistry); MasterContext context = new MasterContext(mJournalSystem, mSafeModeManager, mBackupManager, mStartTimeMs, mPort); mPauseStateLock = context.pauseStateLock(); MasterUtils.createMasters(mRegistry, context);