docs: Set<String> cleanLocks( JcrSession session ) throws RepositoryException {
          Set<String> lockTokens = session.lockManager().lockTokens();
          List<ModeShapeLock> locks = null;
          for (ModeShapeLock lock : locksByNodeKey.values()) {
              if (lock.isSessionScoped() && lockTokens.contains(lock.getLockToken())) {
                  if (locks == null) locks = new LinkedList<ModeShapeLock>();
                  locks.add(lock);
              }
          }
  
          Set<String> cleanedTokens = null;
          if (locks != null) {
              cleanedTokens = new HashSet<>(locks.size());
              // clear the locks which have been unlocked
              unlock(session, locks);
              for (ModeShapeLock lock : locks) {
                  locksByNodeKey.remove(lock.getLockedNodeKey());
                  cleanedTokens.add(lock.getLockToken());
              }
          }
          return cleanedTokens != null ? cleanedTokens : Collections.<String>emptySet();
      }