public static PersistenceManager getPersistenceManager(boolean forCompactor) {
    pmfReadLock.lock();
    try {
      if (pmf == null || (forCompactor && compactorPmf == null)) {
        throw new RuntimeException(
            "Cannot create PersistenceManager. PersistenceManagerFactory is not yet initialized");
      }
      return forCompactor ?
              retry(compactorPmf::getPersistenceManager) :
              retry(pmf::getPersistenceManager);
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      pmfReadLock.unlock();
    }
  }
creates a PersistenceManager instance for the current PersistenceManagerFactory. Note that this
acquires a read-lock on PersistenceManagerFactory so that this method will block if any other
thread is actively, (re-)initializing PersistenceManagerFactory when this method is called
Note that this method throws a RuntimeException, if PersistenceManagerFactory is not yet initialized.

@return PersistenceManager from the current PersistenceManagerFactory instance
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java