Processes parallel bean definitions.
676
protected void processParallelBeans() {
        new Thread(() -> {
            final List<BeanDefinitionReference> parallelBeans = beanDefinitionsClasses.stream()
                    .filter(bd -> bd.getAnnotationMetadata().hasDeclaredStereotype(Parallel.class) && bd.isEnabled(this))
                    .collect(Collectors.toList());


            Collection<BeanDefinition> parallelDefinitions = new ArrayList<>();
            parallelBeans.forEach(beanDefinitionReference -> {
                try {
                    if (isRunning()) {
                        synchronized (singletonObjects) {
                            loadContextScopeBean(beanDefinitionReference, parallelDefinitions::add);
                        }
                    }
                } catch (Throwable e) {
                    LOG.error("Parallel Bean definition [" + beanDefinitionReference.getName() + "] could not be loaded: " + e.getMessage(), e);
                    Boolean shutdownOnError = beanDefinitionReference.getAnnotationMetadata().getValue(Parallel.class, "shutdownOnError", Boolean.class).orElse(true);
                    if (shutdownOnError) {
                        stop();
                    }
                }
            });

            filterProxiedTypes((Collection) parallelDefinitions, true, false);
            filterReplacedBeans((Collection) parallelDefinitions);

            parallelDefinitions.forEach(beanDefinition -> ForkJoinPool.commonPool().execute(() -> {
                try {
                    if (isRunning()) {
                        synchronized (singletonObjects) {
                            loadContextScopeBean(beanDefinition);
                        }
                    }
                } catch (Throwable e) {
                    LOG.error("Parallel Bean definition [" + beanDefinition.getName() + "] could not be loaded: " + e.getMessage(), e);
                    Boolean shutdownOnError = beanDefinition.getAnnotationMetadata().getValue(Parallel.class, "shutdownOnError", Boolean.class).orElse(true);
                    if (shutdownOnError) {
                        stop();
                    }
                }
            }));
            parallelDefinitions.clear();

        }).start();
    }
372744
public static <T, R> void processObject(R r, T src, BiConsumer<R, T> biConsumer) {
        try {
            String beanKey = generateKey(src.getClass(), r.getClass());
            BeanCopier copier = BEAN_COPIER_MAP.getIfPresent(beanKey);
            if (copier == null) {
                copier = BeanCopier.create(src.getClass(), r.getClass(), false);
                BEAN_COPIER_MAP.put(beanKey, copier);
            }
            copier.copy(src, r, null);
            if (biConsumer != null) {
                biConsumer.accept(r, src);
            }
        } catch (Exception e) {
            throw new IllegalArgumentException(e.getMessage(), e);
        }
    }
1057609
public void processAnnotations(List<JCCompilationUnit> roots,
                                   Collection<String> classnames) {
        if (shouldStop(CompileState.PROCESS)) {
            // Errors were encountered.
            // Unless all the errors are resolve errors, the errors were parse errors
            // or other errors during enter which cannot be fixed by running
            // any annotation processors.
            if (unrecoverableError()) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
                return ;
            }
        }

        // ASSERT: processAnnotations and procEnvImpl should have been set up by
        // by initProcessAnnotations

        // NOTE: The !classnames.isEmpty() checks should be refactored to Main.

        if (!processAnnotations) {
            // If there are no annotation processors present, and
            // annotation processing is to occur with compilation,
            // emit a warning.
            if (options.isSet(PROC, "only")) {
                log.warning("proc.proc-only.requested.no.procs");
                todo.clear();
            }
            // If not processing annotations, classnames must be empty
            if (!classnames.isEmpty()) {
                log.error("proc.no.explicit.annotation.processing.requested",
                          classnames);
            }
            Assert.checkNull(deferredDiagnosticHandler);
            return ; // continue regular compilation
        }

        Assert.checkNonNull(deferredDiagnosticHandler);

        try {
            List<ClassSymbol> classSymbols = List.nil();
            List<PackageSymbol> pckSymbols = List.nil();
            if (!classnames.isEmpty()) {
                 // Check for explicit request for annotation
                 // processing
                if (!explicitAnnotationProcessingRequested()) {
                    log.error("proc.no.explicit.annotation.processing.requested",
                              classnames);
                    deferredDiagnosticHandler.reportDeferredDiagnostics();
                    log.popDiagnosticHandler(deferredDiagnosticHandler);
                    return ; // TODO: Will this halt compilation?
                } else {
                    boolean errors = false;
                    for (String nameStr : classnames) {
                        Symbol sym = resolveBinaryNameOrIdent(nameStr);
                        if (sym == null ||
                            (sym.kind == PCK && !processPcks) ||
                            sym.kind == ABSENT_TYP) {
                            if (sym != silentFail)
                                log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                        try {
                            if (sym.kind == PCK)
                                sym.complete();
                            if (sym.exists()) {
                                if (sym.kind == PCK)
                                    pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                                else
                                    classSymbols = classSymbols.prepend((ClassSymbol)sym);
                                continue;
                            }
                            Assert.check(sym.kind == PCK);
                            log.warning(Warnings.ProcPackageDoesNotExist(nameStr));
                            pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                        } catch (CompletionFailure e) {
                            log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                    }
                    if (errors) {
                        deferredDiagnosticHandler.reportDeferredDiagnostics();
                        log.popDiagnosticHandler(deferredDiagnosticHandler);
                        return ;
                    }
                }
            }
            try {
                annotationProcessingOccurred =
                        procEnvImpl.doProcessing(roots,
                                                 classSymbols,
                                                 pckSymbols,
                                                 deferredDiagnosticHandler);
                // doProcessing will have handled deferred diagnostics
            } finally {
                procEnvImpl.close();
            }
        } catch (CompletionFailure ex) {
            log.error("cant.access", ex.sym, ex.getDetailValue());
            if (deferredDiagnosticHandler != null) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
            }
        }
    }
1150804
@Override
	public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
		for (TypeElement dataSource : dataSets) {
			SQLiteDatabaseSchema currentSchema = createDataSource(dataSource);

			// Analyze beans BEFORE daos, because beans are needed for DAO
			// definition
			for (String daoName : currentSchema.getDaoNameSet()) {
				// check dao into bean definition
				createSQLEntityFromDao(currentSchema, dataSource, daoName);

			} // end foreach bean

			// sort table by its name, BEFORE inject generated tables and entities
			Collections.sort(currentSchema.getCollection(), new Comparator<SQLiteDaoDefinition>() {
				@Override
				public int compare(SQLiteDaoDefinition o1, SQLiteDaoDefinition o2) {
					return o1.getTableName().compareTo(o2.getTableName());
				}
			});

			// DAO analysis
			// Get all generated dao definitions
			for (String generatedDaoItem : currentSchema.getDaoNameSet()) {
				createSQLDaoDefinition(currentSchema, globalBeanElements, globalDaoElements, generatedDaoItem);
			}

			analyzeForeignKey(currentSchema);

			// Relation must be done AFTER foreign key building!!!
			analyzeRelations(currentSchema);

			// Analyze custom bean
			analyzeCustomBeanForSelect(currentSchema);
			
			if (currentSchema.getCollection().size() == 0) {
				AssertKripton.fail("DataSource class %s with @%s annotation has no defined DAOs",
						currentSchema.getElement().getSimpleName().toString(),
						BindDataSource.class.getSimpleName(),
						BindDao.class.getSimpleName()
						);
				// info(msg);				
				return true;
			}

			// for each dao definition, we define its uid
			int uid = 0;
			for (SQLiteDaoDefinition daoDefinition : currentSchema.getCollection()) {
				String daoFieldName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, daoDefinition.getName())
						+ "_UID";

				daoDefinition.daoUidName = daoFieldName;
				daoDefinition.daoUidValue = uid;

				uid++;
			}

			schemas.add(currentSchema);
		} // end foreach dataSource

		return true;
	}
157206
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
            throws BeansException {

        BeanDefinitionVisitor visitor =
                new ReloadingPropertyPlaceholderConfigurer.PlaceholderResolvingBeanDefinitionVisitor(props);
        String[] beanNames = beanFactoryToProcess.getBeanDefinitionNames();
        for (int i = 0; i < beanNames.length; i++) {
            // Check that we're not parsing our own bean definition,
            // to avoid failing on unresolvable placeholders in net.unicon.iamlabs.spring.properties.example.net
            // .unicon.iamlabs.spring.properties file locations.
            if (!(beanNames[i].equals(this.beanName) && beanFactoryToProcess.equals(this.beanFactory))) {
                this.currentBeanName = beanNames[i];
                try {
                    BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(beanNames[i]);
                    try {
                        visitor.visitBeanDefinition(bd);
                    } catch (BeanDefinitionStoreException ex) {
                        throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanNames[i],
                                ex.getMessage());
                    }
                } finally {
                    currentBeanName = null;
                }
            }
        }

        StringValueResolver stringValueResolver = new PlaceholderResolvingStringValueResolver(props);

        // New in Spring 2.5: resolve placeholders in alias target names and aliases as well.
        beanFactoryToProcess.resolveAliases(stringValueResolver);

        // New in Spring 3.0: resolve placeholders in embedded values such as annotation attributes.
        beanFactoryToProcess.addEmbeddedValueResolver(stringValueResolver);
    }
1315041
private void processPredecessors()
   {
      for (Map.Entry<Task, List<MapRow>> entry : m_predecessorMap.entrySet())
      {
         Task task = entry.getKey();
         List<MapRow> predecessors = entry.getValue();
         for (MapRow predecessor : predecessors)
         {
            processPredecessor(task, predecessor);
         }
      }
   }
219676
private function processInstances(): void
    {
        $preliminaryMap = [];
        foreach ($this->instances as $instance) {
            $preliminaryMap[get_class($instance)][] = $instance;
            foreach (class_parents($instance) as $parentClass) {
                $preliminaryMap[$parentClass][] = $instance;
            }
            foreach (class_implements($instance) as $parentClass) {
                $preliminaryMap[$parentClass][] = $instance;
            }
        }

        $nextIndex    = 0;
        $hashMap      = []; // hash  => index
        $settingsData = []; // index => instance data
        $getIndex     = function (SettingsInterface $instance) use (&$nextIndex, &$hashMap, &$settingsData): int {
            $hash = spl_object_hash($instance);
            if (array_key_exists($hash, $hashMap) === true) {
                $index = $hashMap[$hash];
            } else {
                $hashMap[$hash]           = $nextIndex;
                $settingsData[$nextIndex] = $instance->get($this->getApplicationData());
                $index                    = $nextIndex++;
            }

            return $index;
        };

        $settingsMap  = []; // class => index
        $ambiguousMap = []; // class => true
        foreach ($preliminaryMap as $class => $instanceList) {
            if (count($instanceList) === 1) {
                $selected = $instanceList[0];
            } else {
                $selected = $this->selectChildSettings($instanceList);
            }
            if ($selected !== null) {
                $settingsMap[$class] = $getIndex($selected);
            } else {
                $ambiguousMap[$class] = true;
            }
        }

        $this->settingsMap  = $settingsMap;
        $this->settingsData = $settingsData;
        $this->ambiguousMap = $ambiguousMap;
        $this->isProcessed  = true;
    }
463048
@Execute
    public void process() throws Exception {
        if (!concatOr(outCb == null, doReset)) {
            return;
        }
        checkNull(inRaster1);
        RenderedImage map1RI = inRaster1.getRenderedImage();
        RenderedImage map2RI = null;
        if (inRaster2 == null) {
            map2RI = map1RI;
        } else {
            map2RI = inRaster2.getRenderedImage();
        }

        outCb = new CoupledFieldsMoments().process(map1RI, map2RI, pBins, pFirst, pLast, pm, binmode);
    }
241201
@Override
	public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
		if (bean instanceof EventSubscriber) {
			Subscribe annotation = getAnnotation(bean.getClass(), beanName);
			if (annotation != null) {
				subscribers.put(beanName, annotation);
			}
		}
		return bean;
	}
852633
protected void processHandlers() {
        // processing should only be done once        
        if (handlers == null) {
            synchronized (this) {
                if (handlers == null) {                    
                    handlers = new HashMap<>();
                    Map<String, WorkItemHandler> foundBeans = context.getBeansOfType(WorkItemHandler.class);
                    for (WorkItemHandler handler : foundBeans.values()) {
                        String name = getComponentName(handler);
                
                        if (name != null && !name.toString().isEmpty()) {
                            logger.debug("Registering {} work item handler under name {}", handler, name);
                            handlers.put(name.toString(), handler);
                        } else {
                            logger.warn("Not possible to register {} handler due to missing name - annotate your class with @Component with given name", handler);
                        }
            
                    }                    
                }
            }
        }
    }
835247
private void processEmitMethods() {
    ElementFilter
        .methodsIn(component.getEnclosedElements())
        .stream()
        .filter(method -> hasAnnotation(method, Emit.class))
        .filter(method -> !hasAnnotation(method, JsMethod.class))
        .forEach(this::exposeExistingJavaMethodToJs);
  }
705156
def process_shells(self, shells):
        """"""
        result = {'success': True, 'output': []}
        if self.parallel and len(shells) > 1:
            result = self.process_shells_parallel(shells)
        elif len(shells) > 0:
            result = self.process_shells_ordered(shells)
        return result
976553
protected void initializeContext(
            @Nonnull List<BeanDefinitionReference> contextScopeBeans,
            @Nonnull List<BeanDefinitionReference> processedBeans) {

        if (CollectionUtils.isNotEmpty(contextScopeBeans)) {
            final Collection<BeanDefinition> contextBeans = new ArrayList<>();

            for (BeanDefinitionReference contextScopeBean : contextScopeBeans) {
                try {
                    loadContextScopeBean(contextScopeBean, contextBeans::add);
                } catch (Throwable e) {
                    throw new BeanInstantiationException("Bean definition [" + contextScopeBean.getName() + "] could not be loaded: " + e.getMessage(), e);
                }
            }
            filterProxiedTypes((Collection) contextBeans, true, false);
            filterReplacedBeans((Collection) contextBeans);

            for (BeanDefinition contextScopeDefinition: contextBeans) {
                try {
                    loadContextScopeBean(contextScopeDefinition);
                } catch (Throwable e) {
                    throw new BeanInstantiationException("Bean definition [" + contextScopeDefinition.getName() + "] could not be loaded: " + e.getMessage(), e);
                }
            }
            contextBeans.clear();
        }

        if (!processedBeans.isEmpty()) {

            @SuppressWarnings("unchecked") Stream<BeanDefinitionMethodReference<?, ?>> methodStream = processedBeans
                    .stream()
                    // is the bean reference enabled
                    .filter(ref -> ref.isEnabled(this))
                    // ok - continue and load it
                    .map((Function<BeanDefinitionReference, BeanDefinition<?>>) reference -> {
                        try {
                            return reference.load(this);
                        } catch (Exception e) {
                            throw new BeanInstantiationException("Bean definition [" + reference.getName() + "] could not be loaded: " + e.getMessage(), e);
                        }
                    })
                    // is the bean itself enabled
                    .filter(bean -> bean.isEnabled(this))
                    // ok continue and get all of the ExecutableMethod references
                    .flatMap(beanDefinition ->
                            beanDefinition.getExecutableMethods()
                                    .parallelStream()
                                    .map((Function<ExecutableMethod<?, ?>, BeanDefinitionMethodReference<?, ?>>) executableMethod ->
                                            BeanDefinitionMethodReference.of((BeanDefinition) beanDefinition, executableMethod)
                                    )
                    );

            // group the method references by annotation type such that we have a map of Annotation -> MethodReference
            // ie. Class<Scheduled> -> @Scheduled void someAnnotation()
            Map<Class<? extends Annotation>, List<BeanDefinitionMethodReference<?, ?>>> byAnnotation = methodStream
                    .collect(
                            Collectors.groupingBy((Function<ExecutableMethod<?, ?>, Class<? extends Annotation>>) executableMethod ->
                                    executableMethod.getAnnotationTypeByStereotype(Executable.class)
                                            .orElseThrow(() ->
                                                    new IllegalStateException("BeanDefinition.requiresMethodProcessing() returned true but method has no @Executable definition. This should never happen. Please report an issue.")
                                            )));

            // Find ExecutableMethodProcessor for each annotation and process the BeanDefinitionMethodReference
            for (Map.Entry<Class<? extends Annotation>, List<BeanDefinitionMethodReference<?, ?>>> entry : byAnnotation.entrySet()) {
                Class<? extends Annotation> annotationType = entry.getKey();
                streamOfType(ExecutableMethodProcessor.class, Qualifiers.byTypeArguments(annotationType))
                        .forEach(processor -> {
                            for (BeanDefinitionMethodReference<?, ?> method : entry.getValue()) {

                                BeanDefinition<?> beanDefinition = method.getBeanDefinition();

                                // Only process the method if the the annotation is not declared at the class level
                                // If declared at the class level it will already have been processed by AnnotationProcessorListener
                                if (!beanDefinition.hasStereotype(annotationType)) {
                                    //noinspection unchecked
                                    if (method.hasDeclaredStereotype(Parallel.class)) {
                                        ForkJoinPool.commonPool().execute(() -> {
                                            try {
                                                processor.process(beanDefinition, method);
                                            } catch (Throwable e) {
                                                if (LOG.isErrorEnabled()) {
                                                    LOG.error("Error processing bean method " + beanDefinition + "." + method + " with processor (" + processor + "): " + e.getMessage(), e);
                                                }
                                                Boolean shutdownOnError = method.getValue(Parallel.class, "shutdownOnError", Boolean.class).orElse(true);
                                                if (shutdownOnError) {
                                                    stop();
                                                }
                                            }
                                        });
                                    } else {
                                        processor.process(beanDefinition, method);
                                    }
                                }
                            }

                            if (processor instanceof Completable) {
                                ((Completable) processor).onComplete();
                            }

                        });
            }
        }

        final Runnable runnable = () ->
                beanDefinitionsClasses.removeIf((BeanDefinitionReference beanDefinitionReference) ->
                        !beanDefinitionReference.isEnabled(this));
        if (ClassLoadingReporter.isReportingEnabled()) {
            // do this in a blocking manner so that reporting is immediately aware of missing classes
            runnable.run();
        } else {
            // proactively remove bean definitions that are not enabled
            new Thread(runnable).start();
        }

    }
817220
public void process(SearchDistributor distributor) {
        List<PossibleState> bootStrap;
        try {
            bootStrap = bfs(bootStrapMin);
        } catch (ModelException e) {
            bootStrap = new LinkedList<>();
        }

        List<Frontier> frontiers = new LinkedList<>();
        for (PossibleState p : bootStrap) {
            SCXMLFrontier dge = new SCXMLFrontier(p, model, tagExtensionList);
            frontiers.add(dge);
        }

        distributor.distribute(frontiers);
    }
1279873
protected void processQueue() {
        try {
            Collection<RequestMetric> batch = new ArrayList<>(this.batchSize);
            RequestMetric rm = queue.take();
            batch.add(rm);
			queue.drainTo(batch, this.batchSize - 1);
			
			Builder builder = new Bulk.Builder();
			for (RequestMetric metric : batch) {
	            Index index = new Index.Builder(metric).refresh(false)
	                    .index(getIndexName())
	                    .type("request").build(); //$NON-NLS-1$
				builder.addAction(index);
			}
            
            BulkResult result = getClient().execute(builder.build());
            if (!result.isSucceeded()) {
                logger.warn("Failed to add metric(s) to ES"); //$NON-NLS-1$
            }
        } catch (Exception e) {
            logger.warn("Error adding metric to ES"); //$NON-NLS-1$
            return;
        }
    }
1318139
@Override
	public void process(Node externs, Node root) {
		this.expandedDepsList.clear();
		List<DependencyList> enclosingDependencies = new LinkedList<DependencyList>();
		try {
			processChildren(root, enclosingDependencies);
		} catch (ProcessingDependenciesException e) {
			throw new RuntimeProcessingDependenciesException(e);
		} catch (DependencyVerificationException e) {
			throw new RuntimeDependencyVerificationException(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		appendConsoleLogging(root);
	}
1173974
public function process()
    {
        $gridField = $this->getGridField();

        if ($this->Columns) {
            $columns = $this->Columns;
        } elseif ($dataCols = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class)) {
            $columns = $dataCols->getDisplayFields($gridField);
        } else {
            $columns = singleton($gridField->getModelClass())->summaryFields();
        }

        if ($this->IncludeHeader && !$this->HeadersOutput) {
            $this->outputHeader($gridField, $columns);
            $this->HeadersOutput = true;
        }

        $chunkSize = $this->config()->get('chunk_size');

        $this->outputRows($gridField, $columns, $this->currentStep, $chunkSize);

        $this->currentStep += $chunkSize;

        if ($this->currentStep >= $this->totalSteps) {
            // Check to see if we need to wait for some time for asset synchronisation to complete
            $sleepTime = (int) $this->config()->get('sync_sleep_seconds');
            if ($sleepTime > 0) {
                sleep($sleepTime);
            }

            $this->isComplete = true;
        }
    }