code: protected Session session(String repoName, String wsName, List<String> lockTokens) throws Exception,
        NoSuchWorkspaceException
     {
        // To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
        ManageableRepository repo = repositoryService.getCurrentRepository();
        if (PropertyManager.isDevelopping() && log.isWarnEnabled())
        {
           String currentRepositoryName = repo.getConfiguration().getName();
           if (!currentRepositoryName.equals(repoName))
           {
              log.warn("The expected repository was '" + repoName
                 + "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
           }
        }
        SessionProvider sp = sessionProviderService.getSessionProvider(null);
        if (sp == null)
           throw new RepositoryException("SessionProvider is not properly set. Make the application calls"
              + "SessionProviderService.setSessionProvider(..) somewhere before ("
              + "for instance in Servlet Filter for WEB application)");
  
        Session session = sp.getSession(wsName, repo);
        if (lockTokens != null)
        {
           String[] presentLockTokens = session.getLockTokens();
           ArrayList<String> presentLockTokensList = new ArrayList<String>();
           for (int i = 0; i < presentLockTokens.length; i++)
           {
              presentLockTokensList.add(presentLockTokens[i]);
           }
  
           for (int i = 0; i < lockTokens.size(); i++)
           {
              String lockToken = lockTokens.get(i);
              if (!presentLockTokensList.contains(lockToken))
              {
                 session.addLockToken(lockToken);
              }
           }
        }
        return session;
     }
docs: Gives access to the current session.
  
  @param repoName repository name
  @param wsName workspace name
  @param lockTokens Lock tokens
  @return current session
  @throws Exception {@link Exception}