code: private void closeAllSession(ManageableRepository mr) throws NoSuchWorkspaceException
     {
        for (String wsName : mr.getWorkspaceNames())
        {
           if (!mr.canRemoveWorkspace(wsName))
           {
              WorkspaceContainerFacade wc = mr.getWorkspaceContainer(wsName);
              SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
              sessionRegistry.closeSessions(wsName);
           }
        }
     }
docs: Close all open session in repository
  
  @param mr
  
  @throws NoSuchWorkspaceException