Starts new context using provided configuration.

    Raises RuntimeConfigError if a context is already active.
8255
def start(**kwargs):
    
    if CORE_MANAGER.started:
        raise RuntimeConfigError('Current context has to be stopped to start '
                                 'a new context.')

    try:
        waiter = kwargs.pop('waiter')
    except KeyError:
        waiter = hub.Event()
    common_config = CommonConf(**kwargs)
    hub.spawn(CORE_MANAGER.start, *[], **{'common_conf': common_config,
                                          'waiter': waiter})
    return True
1286614
def start(
    context: typing.Optional[typing.Mapping] = None,
    banner: typing.Optional[str] = None,
    shell: typing.Type[Shell] = AutoShell,
    prompt: typing.Optional[str] = None,
    output: typing.Optional[str] = None,
    context_format: str = "full",
    **kwargs: typing.Any,
) -> None:
    
    logger.debug(f"Using shell: {shell!r}")
    if banner is None:
        banner = speak()
    # Default to global config
    context_ = context or _cfg["context"]
    banner_ = banner or _cfg["banner"]
    if isinstance(shell, type) and issubclass(shell, Shell):
        shell_ = shell
    else:
        shell_ = SHELL_MAP.get(shell or _cfg["shell"], _cfg["shell"])
    prompt_ = prompt or _cfg["prompt"]
    output_ = output or _cfg["output"]
    context_format_ = context_format or _cfg["context_format"]
    shell_(
        context=context_,
        banner=banner_,
        prompt=prompt_,
        output=output_,
        context_format=context_format_,
        **kwargs,
    ).start()
358459
@Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext context = sce.getServletContext();
        String propertiesConfig = context.getInitParameter(PROPERTIES_CONFIG);
        if(propertiesConfig == null) {
            propertiesConfig = PROPERTIES_CONFIG_DEFAULT;
        }
        SystemProperties config = loadConfiguration(propertiesConfig, context);
        addProperties(config);
        if(config.getFile() != null) {
            addPropertiesFromFile(config, context);
        }
        
    }
1081661
protected void setup(Mapper.Context context) {
        Configuration conf = context.getConfiguration();
        extractor = new CooccurrenceExtractor(conf);

        // Set up the IteratorFactory properties           
        Properties props = new Properties();
        for (String property : ITERATOR_FACTORY_PROPERTIES) {
            String propVal = conf.get(property);
            if (propVal != null)
                props.setProperty(property, propVal);
        }
        
        // Create the ResourceFinder that the IteratorFactory will use to find
        // the various files on HDFS
        ResourceFinder hadoopRf = null;
        try {
            hadoopRf = new HadoopResourceFinder(conf);
        } catch (IOException ioe) {
            throw new IOError(ioe);
        }

        // Set the IteratorFactory to locate the resources and then have it
        // reconfigure itself based on the user specified properties
        IteratorFactory.setResourceFinder(hadoopRf);        
        IteratorFactory.setProperties(props);
    }
155526
public void init(Configuration configuration) throws Exception {
        if (configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME) != null) {
            log.debug("Configuring context timeout with value ", configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME));
            try {
                contextTimeout = Long.parseLong(configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME));
            } catch (NumberFormatException e) {
                log.warn("Init parameter ", CONTEXT_TIMEOUT_NAME, " is not a parsable long, timeout will be ", " instead");
                contextTimeout = DEFAULT_CONTEXT_TIMEOUT;
            }
        }
    }
1123028
def instantiate(self, config, *args, **kwargs):
        
        for plugin_config in config:
            self.new_plugin(plugin_config, *args, **kwargs)
555205
def spawn(self, context=None):
        
        if context is None:
            context = self.default_context

        if isinstance(context, collections.Callable):
            context = context()

        if not isinstance(context, collections.Mapping):
            raise PatchboardError('Cannot determine a valid context')

        return Client(self, context, self.api, self.endpoint_classes)
378290
protected final void configureWebAppContext(WebAppContext context,
			ServletContextInitializer... initializers) {
		Assert.notNull(context, "Context must not be null");
		context.setTempDirectory(getTempDirectory());
		if (this.resourceLoader != null) {
			context.setClassLoader(this.resourceLoader.getClassLoader());
		}
		String contextPath = getContextPath();
		context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/");
		context.setDisplayName(getDisplayName());
		configureDocumentRoot(context);
		if (isRegisterDefaultServlet()) {
			addDefaultServlet(context);
		}
		if (shouldRegisterJspServlet()) {
			addJspServlet(context);
			context.addBean(new JasperInitializer(context), true);
		}
		addLocaleMappings(context);
		ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
		Configuration[] configurations = getWebAppContextConfigurations(context,
				initializersToUse);
		context.setConfigurations(configurations);
		context.setThrowUnavailableOnStartupException(true);
		configureSession(context);
		postProcessWebAppContext(context);
	}
126714
@Validate
    public void start() {
        Boolean enabled = configuration.getBooleanWithDefault("ehcache.enabled", true);
        if (!enabled) {
            return;
        }

        File config = new File(configuration.getBaseDir(), CUSTOM_CONFIGURATION);
        final ClassLoader original = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            if (config.isFile()) {
                manager = CacheManager.create(config.getAbsolutePath());
            } else {
                URL url = EhCacheService.class.getClassLoader().getResource(INTERNAL_CONFIGURATION);
                if (url != null) {
                    manager = CacheManager.create(url);
                } else {
                    throw new ExceptionInInitializerError("Cannot instantiate EhCache, " +
                            "cannot load " + INTERNAL_CONFIGURATION + " file");
                }
            }
            manager.addCache(WISDOM_KEY);
            cache = manager.getCache(WISDOM_KEY);

            registration = context.registerService(Cache.class, this, new Hashtable<String, Object>());
        } finally {
            Thread.currentThread().setContextClassLoader(original);
        }


    }
1133707
@Override
    public synchronized BeanContext start() {
        if (!isRunning()) {

            if (initializing.compareAndSet(false, true)) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Starting BeanContext");
                }
                readAllBeanConfigurations();
                readAllBeanDefinitionClasses();
                if (LOG.isDebugEnabled()) {
                    String activeConfigurations = beanConfigurations
                            .values()
                            .stream()
                            .filter(config -> config.isEnabled(this))
                            .map(BeanConfiguration::getName)
                            .collect(Collectors.joining(","));
                    if (StringUtils.isNotEmpty(activeConfigurations)) {
                        LOG.debug("Loaded active configurations: {}", activeConfigurations);
                    }
                }
                if (LOG.isDebugEnabled()) {
                    LOG.debug("BeanContext Started.");
                }
                publishEvent(new StartupEvent(this));
            }
            // start thread for parallel beans
            processParallelBeans();
            running.set(true);
            initializing.set(false);
        }
        return this;
    }
1241773
def _ensure_initialized(cls, instance=None, gateway=None, conf=None):
        
        with SparkContext._lock:
            if not SparkContext._gateway:
                SparkContext._gateway = gateway or launch_gateway(conf)
                SparkContext._jvm = SparkContext._gateway.jvm

            if instance:
                if (SparkContext._active_spark_context and
                        SparkContext._active_spark_context != instance):
                    currentMaster = SparkContext._active_spark_context.master
                    currentAppName = SparkContext._active_spark_context.appName
                    callsite = SparkContext._active_spark_context._callsite

                    # Raise error if there is already a running Spark context
                    raise ValueError(
                        "Cannot run multiple SparkContexts at once; "
                        "existing SparkContext(app=%s, master=%s)"
                        " created by %s at %s:%s "
                        % (currentAppName, currentMaster,
                            callsite.function, callsite.file, callsite.linenum))
                else:
                    SparkContext._active_spark_context = instance
513477
@Trivial
    protected void activate(ComponentContext context) throws Exception {
        Dictionary<String, ?> props = context.getProperties();
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "activate", props);

        adminObjectImplClassName = (String) props.get(CONFIG_PROPS_PREFIX + "adminobject-class");
        name = (String) props.get("config.id");
        id = (String) props.get("id");
        jndiName = (String) props.get("jndiName");

        for (Enumeration<String> keys = props.keys(); keys.hasMoreElements();) {
            String key = keys.nextElement();
            if (key.length() > CONFIG_PROPS_PREFIX_LENGTH && key.charAt(CONFIG_PROPS_PREFIX_LENGTH - 1) == '.' && key.startsWith(CONFIG_PROPS_PREFIX)) {
                String propName = key.substring(CONFIG_PROPS_PREFIX_LENGTH);
                if (propName.indexOf('.') < 0 && propName.indexOf('-') < 0)
                    properties.put(propName, props.get(key));
            }
        }

        bootstrapContextRef.activate(context);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "activate");
    }
1159064
public static ConfigurableApplicationContext start(Class<?>[] app, String... args) {
        Class<?>[] apps = ObjectArrays.concat(app, GHEventApiServer.class);
        return SpringApplication.run(apps, args);
    }
134631
public void configureDefaults() throws Exception
    {
        //cannot configure if the context is already started
        if (_context.isStarted())
        {
            if (log.isDebugEnabled()){log.debug("Cannot configure webapp after it is started");};
            return;
        }
        
        getWebApplicationContext().setWelcomeFiles(null);
        
        String defaultsDescriptor=getWebApplicationContext().getDefaultsDescriptor();
        if(defaultsDescriptor!=null&&defaultsDescriptor.length()>0)
        {
            Resource dftResource=Resource.newSystemResource(defaultsDescriptor);
            if(dftResource==null)
                dftResource=Resource.newResource(defaultsDescriptor);
            XmlParser.Node defaultConfig=xmlParser.parse(dftResource.getURL());
            initialize(defaultConfig);
        }
    }
558937
private static RunContext createBottomContext() {
    File spockUserHome = SpockUserHomeUtil.getSpockUserHome();
    DelegatingScript script = new ConfigurationScriptLoader(spockUserHome).loadAutoDetectedScript();
    List<Class<?>> classes = new ExtensionClassesLoader().loadClassesFromDefaultLocation();
    return new RunContext("default", spockUserHome, script, classes);
  }
782430
def prepare_context(env)
      context = Roger::Template::TemplateContext.new(self, env)

      # Extend context with all helpers
      self.class.helpers.each do |mod|
        context.extend(mod)
      end

      context
    end
1003903
@Trivial
    protected void activate(ComponentContext context) throws Exception {
        Dictionary<String, ?> props = context.getProperties();
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "activate", props);

        destinationRef.activate(context);
        bootstrapContextRef.activate(context);
        rrsXAResFactorySvcRef.activate(context);

        componentContext = context;
        activationSpecClassName = (String) props.get(CONFIG_PROPS_PREFIX + "activationspec-class");
        id = (String) context.getProperties().get(ID);

        // filter out actual config properties for the activation specification
        for (Enumeration<String> keys = props.keys(); keys.hasMoreElements();) {
            String key = keys.nextElement();
            if (key.length() > CONFIG_PROPS_PREFIX_LENGTH && key.charAt(CONFIG_PROPS_PREFIX_LENGTH - 1) == '.' && key.startsWith(CONFIG_PROPS_PREFIX)) {
                String propName = key.substring(CONFIG_PROPS_PREFIX_LENGTH);
                if (propName.indexOf('.') < 0 && propName.indexOf('-') < 0 && !"destinationRef".equals(propName))
                    configProps.put(propName, props.get(key));
            }
        }
        requiredConfigProps = (String[]) props.get(CONFIG_PROPS_PREFIX + "required-config-property");
        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "activate");
    }