code: @Override
    public void run() {
      try {
        InjectionHandler.processEvent(InjectionEvent.DIRECTORY_SCANNER_NOT_STARTED);
        if (!shouldRun) {
          //shutdown has been activated
          LOG.warn("this cycle terminating immediately because 'shouldRun' has been deactivated");
          return;
        }
  
        Integer[] namespaceIds = datanode.getAllNamespaces();
        for(Integer nsid : namespaceIds) {
          UpgradeManagerDatanode um = 
            datanode.getUpgradeManager(nsid);
          if (um != null && !um.isUpgradeCompleted()) {
            //If distributed upgrades underway, exit and wait for next cycle.
            LOG.warn("this cycle terminating immediately because Distributed Upgrade is in process");
            return; 
          }
        }
        
        //We're are okay to run - do it
        delta.resetDelta();
        delta.startRecordingDelta();
        checkDifferenceAndReconcile();      
        
      } catch (Exception e) {
        //Log and continue - allows Executor to run again next cycle
        LOG.error("Exception during DirectoryScanner execution - will continue next cycle", e);
      } catch (Error er) {
        //Non-recoverable error - re-throw after logging the problem
        LOG.error("System Error during DirectoryScanner execution - permanently terminating periodic scanner", er);
        throw er;
      } finally {
        delta.stopRecordingDelta();
        InjectionHandler.processEvent(InjectionEvent.DIRECTORY_SCANNER_FINISHED);
      }
    }
docs: Main program loop for DirectoryScanner
  Runs "reconcile()" periodically under the masterThread.