Find main locations

@param bootProps An instance of BootstrapConfig
@param processName Process name to be used
3978
protected void findLocations(BootstrapConfig bootProps, String processName) {
        // Check for environment variables...
        String userDirStr = getEnv(BootstrapConstants.ENV_WLP_USER_DIR);
        String serversDirStr = getEnv(bootProps.getOutputDirectoryEnvName());

        // Check for the variable calculated by the shell script first (X_LOG_DIR)
        // If that wasn't found, check for LOG_DIR set for java -jar invocation
        String logDirStr = getEnv(BootstrapConstants.ENV_X_LOG_DIR);
        if (logDirStr == null)
            logDirStr = getEnv(BootstrapConstants.ENV_LOG_DIR);

        // Likewise for X_LOG_FILE and LOG_FILE.
        String consoleLogFileStr = getEnv(BootstrapConstants.ENV_X_LOG_FILE);
        if (consoleLogFileStr == null)
            consoleLogFileStr = getEnv(BootstrapConstants.ENV_LOG_FILE);

        // Do enough processing to know where the directories should be..
        // this should not cause any directories to be created
        bootProps.findLocations(processName, userDirStr, serversDirStr, logDirStr, consoleLogFileStr);
    }
770761
public static void main(String[] args) {
    ProcessEntryPoint entryPoint = ProcessEntryPoint.createForArguments(args);
    Props props = entryPoint.getProps();
    new CeProcessLogging().configure(props);
    CeServer server = new CeServer(
      new ComputeEngineImpl(props, new ComputeEngineContainerImpl()),
      new MinimumViableSystem());
    entryPoint.launch(server);
  }
674199
protected function buildProcesses($processes, $container, $processClass, $stepClass)
    {
        $processReferences = array();

        foreach ($processes as $processName => $processConfig) {
            if (!empty($processConfig['import'])) {
                if (is_file($processConfig['import'])) {
                    $yaml = new Parser();
                    $config = $yaml->parse(file_get_contents($processConfig['import']));

                    $processConfig = array_merge($processConfig, $config[$processName]);
                } else {
                    throw new \InvalidArgumentException(sprintf('Can\'t load process from file "%s"', $processConfig['import']));
                }
            }

            $stepReferences = $this->buildSteps($processName, $processConfig['steps'], $container, $stepClass);

            $definition = new Definition($processClass, array(
                $processName,
                $stepReferences,
                $processConfig['start'],
                $processConfig['end'],
            ));

            $definition->setPublic(false)
                       ->addTag('lexik_workflow.process', array('alias' => $processName));

            $processReference = sprintf('lexik_workflow.process.%s', $processName);
            $container->setDefinition($processReference, $definition);

            $processReferences[$processName] = new Reference($processReference);
        }

        return $processReferences;
    }
1142412
private synchronized boolean bootAmx(MBeanServerExecutor pServers, final LogHandler pLoghandler) {
        ObjectName bootMBean = null;
        try {
            bootMBean = new ObjectName("amx-support:type=boot-amx");
        } catch (MalformedObjectNameException e) {
            // Cannot happen ....
        }
        try {
            pServers.call(bootMBean, new MBeanServerExecutor.MBeanAction<Void>() {
                /** {@inheritDoc} */
                public Void execute(MBeanServerConnection pConn, ObjectName pName, Object ... extraArgs)
                        throws ReflectionException, InstanceNotFoundException, IOException, MBeanException {
                    pConn.invoke(pName, "bootAMX", null, null);
                    return null;
                }
            });
            return true;
        } catch (InstanceNotFoundException e) {
            pLoghandler.error("No bootAmx MBean found: " + e,e);
            // Can happen, when a call to bootAmx comes to early before the bean
            // is registered
            return false;
        } catch (IllegalArgumentException e) {
            pLoghandler.error("Exception while booting AMX: " + e,e);
            // We dont try it again
            return true;
        } catch (Exception e) {
            pLoghandler.error("Exception while executing bootAmx: " + e, e);
            // dito
            return true;
        }
    }
211049
public void parseProcessDefinitions() {
    for (Element processElement : rootElement.elements("process")) {
      boolean isExecutable = !deployment.isNew();
      String isExecutableStr = processElement.attribute("isExecutable");
      if (isExecutableStr != null) {
        isExecutable = Boolean.parseBoolean(isExecutableStr);
        if (!isExecutable) {
          LOG.ignoringNonExecutableProcess(processElement.attribute("id"));
        }
      } else {
        LOG.missingIsExecutableAttribute(processElement.attribute("id"));
      }

      // Only process executable processes
      if (isExecutable) {
        processDefinitions.add(parseProcess(processElement));
      }
    }
  }
1002124
def locate(cls):
    
    if cls._INSTANCE is None:
      bootstrap_path = __file__
      module_import_path = __name__.split('.')

      # For example, our __file__ might be requests.pex/.bootstrap/pex/bootstrap.pyc and our import
      # path pex.bootstrap; so we walk back through all the module components of our import path to
      # find the base sys.path entry where we were found (requests.pex/.bootstrap in this example).
      for _ in module_import_path:
        bootstrap_path = os.path.dirname(bootstrap_path)

      cls._INSTANCE = cls(sys_path_entry=bootstrap_path)
    return cls._INSTANCE
518217
private void bootstrap() {
    List<MemberId> activePeers = bootstrapPeersSupplier.get();
    if (activePeers.isEmpty()) {
      return;
    }
    try {
      requestBootstrapFromPeers(activePeers)
          .get(DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
      LOGGER.debug("Failed to bootstrap ec map {}: {}", mapName, ExceptionUtils.getStackTrace(e));
    }
  }
550137
function (name, value) {
                if (typeof name === 'string') {
                    Boot.config[name] = value;
                } else {
                    for (var s in name) {
                        Boot.setConfig(s, name[s]);
                    }
                }
                return Boot;
            }
223864
@Override
    public List<ProcessInstanceLog> findProcessInstances() {
        EntityManager em = getEntityManager();
        Query query = em.createQuery("FROM ProcessInstanceLog");
        return executeQuery(query, em, ProcessInstanceLog.class);
    }
581902
private void initStage(List<String> currentProcesses) {
        // 3. 循环处理每个process
        List<Long> processIds = new ArrayList<Long>();
        for (String process : currentProcesses) {
            processIds.add(StagePathUtils.getProcessId(process));
        }
        Collections.sort(processIds); // 排序一下
        List<Long> needSyncProcessIds = new ArrayList<Long>();

        synchronized (currentProcessIds) { // 需要同步处理
            for (Long processId : processIds) {
                if (!currentProcessIds.contains(processId)) {
                    needSyncProcessIds.add(processId);
                }
            }

            for (Long currentProcessId : currentProcessIds) {
                if (!processIds.contains(currentProcessId)) {
                    currentStages.remove(currentProcessId);// 如果process已删除,删除本地的stage信息
                }
            }

            if (logger.isDebugEnabled()) {
                logger.debug("pipeline[{}] old processIds{},current processIds{}", new Object[] { getPipelineId(),
                        currentProcessIds, processIds });
            }

            currentProcessIds = processIds; // 切换引用，需设置为volatile保证线程安全&可见性
        }

        for (Long syncProcessId : needSyncProcessIds) {
            syncStage(syncProcessId);// 开始同步单个的process
            // boolean reply = initProcessStage(processId);// 通知下节点变化
            // if (!currentProcessIds.contains(processId) && reply == false) {
            // syncStage(processId);// 开始同步单个的process
            // } else {
            // // 如果上一次循环中已经添加了监控，则忽略掉本次处理, 避免重复监听
            // }
        }

        if (processIds.size() > 0) {// 尝试触发一下第一个process进行load
            initProcessStage(processIds.get(0));
        }
        processChanged(currentProcessIds);// 通知变化
    }
412560
public String getOSExtensionDefinition(BootstrapConfig bootProps) {
        String osExtension = bootProps.get(BOOTPROP_OS_EXTENSIONS);

        if (osExtension == null) {
            String normalizedName = getNormalizedOperatingSystemName(bootProps.get("os.name"));
            osExtension = defaults.getProperty(MANIFEST_OS_EXTENSION + normalizedName);
        }

        if (osExtension != null)
            bootProps.put(BOOTPROP_OS_EXTENSIONS, osExtension);

        return osExtension;
    }
1148233
public function bootstrap(array $processes)
    {
        $bootstrap = new Bootstrap($processes, $this->getContainer());
        $bootstrap->boot();
        return $this;
    }
671699
private CompletableFuture<Void> bind(ServerBootstrap bootstrap) {
    CompletableFuture<Void> future = new CompletableFuture<>();
    int port = config.getPort() != null ? config.getPort() : returnAddress.port();
    if (config.getInterfaces().isEmpty()) {
      bind(bootstrap, Lists.newArrayList("0.0.0.0").iterator(), port, future);
    } else {
      bind(bootstrap, config.getInterfaces().iterator(), port, future);
    }
    return future;
  }
747985
private void useDefaultConf() {
        appName = getDefaultAppName();
        rootPackage = getDefaultRootPackage() + "." + getDefaultAppName();
        bootstrapPackName = getDefaultBootstrapPackName();
        sqlConfName = getDefaultSqlConfName();
    }
691418
public static void main(Class main, String[] args, String[] packageNamesToWeave) throws Exception{
    for (String packageName : packageNamesToWeave) {
      weavePackage(packageName);
    }
    ArrayList<String> l = new ArrayList<String>(Arrays.asList(args));
    l.add(0, "-mainClass");
    l.add(1, main.getName());
    _init.boot2(l.toArray(new String[0]));
  }
702864
public function boot()
    {
        // call environment method if exists
        // e.g. envDev() envProd() envStating() envTesting()
        $envMethod = 'env'.ucfirst(strtolower($this->application->getKernel()->getEnv()));
        $this->call($envMethod);

        // run processes
        foreach ($this->processes as $process) {
            $processResolved = $this->resolver->resolve($process);
            $processResolved->boot();
        }

        // call method beginning by $bootMethodsPrefix
        $bootMethods = get_class_methods(get_class($this));
        if (!empty($bootMethods)) {
            $l = strlen($this->bootMethodsPrefix);
            foreach ($bootMethods as $bootMethod) {
                if (substr($bootMethod, 0, $l) === $this->bootMethodsPrefix) {
                    $this->call($bootMethod);
                }
            }
        }

        return true;
    }
384592
public Long getProcessId(String procname) throws Exception {
        Process proc = ProcessCache.getProcess(procname, 0);
        if (proc == null)
            throw new DataAccessException(0, "Cannot find process with name "
                    + procname + ", version 0");

        return proc.getId();
    }