code: public void checkLock(Session session, String path, List<String> tokens) throws LockException
     {
        String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;
  
        String currentToken = nullResourceLocks.get(repoPath);
  
        if (currentToken == null)
        {
           return;
        }
  
        if (tokens != null)
        {
           for (String token : tokens)
           {
              if (token.equals(currentToken))
              {
                 return;
              }
           }
        }
  
        throw new LockException("Resource already locked " + repoPath);
     }
docs: Checks if the node can be unlocked using current tokens.
  
  @param session current session
  @param path node path
  @param tokens tokens
  @throws LockException {@link LockException}