code: private Thread createThreadFindNodesCount(final Reindexable reindexableComponent)
     {
        return new Thread("Nodes count(" + handler.getContext().getWorkspaceName() + ")")
        {
           public void run()
           {
              try
              {
                 if (reindexableComponent != null)
                 {
                    Long value = reindexableComponent.getNodesCount();
                    if (value != null)
                    {
                       nodesCount = new AtomicLong(value);
                    }
                 }
              }
              catch (RepositoryException e)
              {
                 LOG.error("Can't calculate nodes count : " + e.getMessage());
              }
           }
        };
     }
docs: Create thread finding count of nodes.