@Override public JournalContext createJournalContext() throws UnavailableException { // All modifications to journaled state must happen inside of a journal context so that we can // persist the state change. As a mechanism to allow for state pauses, we acquire the state // change lock before entering any code paths that could modify journaled state. try (LockResource l = new LockResource(mMasterContext.stateChangeLock())) { return mJournal.createJournalContext(); } } }
/** * @param masterContext the context for Alluxio master * @param clock the Clock to use for determining the time * @param executorServiceFactory a factory for creating the executor service to use for * running maintenance threads */ protected AbstractMaster(MasterContext masterContext, Clock clock, ExecutorServiceFactory executorServiceFactory) { Preconditions.checkNotNull(masterContext, "masterContext"); mJournal = masterContext.getJournalSystem().createJournal(this); mSafeModeManager = masterContext.getSafeModeManager(); mBackupManager = masterContext.getBackupManager(); mStateChangeLock = masterContext.stateChangeLock(); mPauseStateLock = masterContext.pauseStateLock(); mClock = clock; mExecutorServiceFactory = executorServiceFactory; }