code: @PreDestroy
      public void stopListening() throws RepositoryException {
          try {
              LOGGER.debug("Destroying an observer for JCR events...");
              session.getWorkspace().getObservationManager().removeEventListener(this);
          } finally {
              session.logout();
          }
      }
docs: logout of the session
  
  @throws RepositoryException if repository exception occurred