protected GenericThreadedImportTask createNewTask(
     DocumentModel parent, SourceNode node, ImporterLogger log, Integer batchSize) {
   GenericThreadedImportTask newTask =
       new GenericThreadedImportTask(
           repositoryName,
           node,
           parent,
           skipContainerCreation,
           log,
           batchSize,
           factory,
           threadPolicy,
           null);
   newTask.addListeners(listeners);
   newTask.addImportingDocumentFilters(importingDocumentFilters);
   return newTask;
 }
  protected GenericThreadedImportTask createNewTaskIfNeeded(DocumentModel parent, SourceNode node) {
    if (isRootTask) {
      isRootTask = false; // don't fork Root thread on first folder
      return null;
    }
    int scheduledTasks = GenericMultiThreadedImporter.getExecutor().getQueue().size();
    boolean createTask =
        getThreadPolicy()
            .needToCreateThreadAfterNewFolderishNode(
                parent, node, uploadedFiles, batchSize, scheduledTasks);

    if (createTask) {
      GenericThreadedImportTask newTask = createNewTask(parent, node, rsLogger, batchSize);
      newTask.setBatchSize(getBatchSize());
      newTask.setSkipContainerCreation(true);
      newTask.setTransactionTimeout(transactionTimeout);
      return newTask;
    } else {
      return null;
    }
  }