code: private static GlobalInterlock _findAndRefreshLock(EntityManager em, long type) {
          GlobalInterlock lock = em.find(GlobalInterlock.class, type);
  
          if (lock != null) {
              try {
                  em.refresh(lock);
                  lock = em.find(GlobalInterlock.class, type);
              } catch (EntityNotFoundException ex) {
                  LOGGER.warn("Lock of type {} was expired by another process.", type);
                  lock = null;
              }
          }
          return lock;
      }
docs: ~ Methods **************************************************************************************************************************************