Example usage for java.lang Boolean getBoolean

List of usage examples for java.lang Boolean getBoolean

Introduction

In this page you can find the example usage for java.lang Boolean getBoolean.

Prototype

public static boolean getBoolean(String name) 

Source Link

Document

Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string "true" .

Usage

From source file:org.apache.geode.management.internal.cli.shell.GfshConfig.java

public boolean isANSISupported() {
    return !Boolean.getBoolean("gfsh.disable.color");
}

From source file:com.adeptj.runtime.osgi.FrameworkManager.java

private void provisionBundles() throws IOException {
    // config directory will not yet be created if framework is being provisioned first time.
    if (!Boolean.getBoolean("provision.bundles.explicitly")
            && Paths.get(Configs.of().felix().getString(CFG_KEY_FELIX_CM_DIR)).toFile().exists()) {
        LOGGER.info("As per configuration, bundles provisioning is skipped on server restart!!");
    } else {//from  w  w w.  j  a  v  a 2s .  c  om
        Bundles.provisionBundles();
    }
}

From source file:com.jfinal.ext.plugin.redis.JedisPlugin.java

private void parseSetting(String key, String value) {
    if ("timeout".equalsIgnoreCase(key)) {
        timeout = Integer.valueOf(value);
    } else if ("password".equalsIgnoreCase(key)) {
        password = value;/*from  ww w  .j  av a  2 s .co  m*/
    } else if ("host".equalsIgnoreCase(key)) {
        host = value;
    } else if ("maxactive".equalsIgnoreCase(key)) {
        maxactive = Integer.valueOf(value);
    } else if ("maxidle".equalsIgnoreCase(key)) {
        maxidle = Integer.valueOf(value);
    } else if ("maxwait".equalsIgnoreCase(key)) {
        maxwait = Integer.valueOf(value);
    } else if ("minevictableidletimemillis".equalsIgnoreCase(key)) {
        minevictableidletimemillis = Long.valueOf(value);
    } else if ("minidle".equalsIgnoreCase(key)) {
        minidle = Integer.valueOf(value);
    } else if ("numtestsperevictionrun".equalsIgnoreCase(key)) {
        numtestsperevictionrun = Integer.valueOf(value);
    } else if ("softminevictableidletimemillis".equalsIgnoreCase(key)) {
        softminevictableidletimemillis = Long.valueOf(value);
    } else if ("timebetweenevictionrunsmillis".equalsIgnoreCase(key)) {
        timebetweenevictionrunsmillis = Long.valueOf(value);
    } else if ("whenexhaustedaction".equalsIgnoreCase(key)) {
        if ("WHEN_EXHAUSTED_BLOCK".equalsIgnoreCase(value)) {
            whenexhaustedaction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
        } else if ("WHEN_EXHAUSTED_FAIL".equalsIgnoreCase(value)) {
            whenexhaustedaction = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
        } else if ("WHEN_EXHAUSTED_GROW".equalsIgnoreCase(value)) {
            whenexhaustedaction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
        }
    } else if ("testwhileidle".equalsIgnoreCase(key)) {
        testwhileidle = Boolean.getBoolean(value);
    } else if ("testonreturn".equalsIgnoreCase(key)) {
        testonreturn = Boolean.getBoolean(value);
    } else if ("testonborrow".equalsIgnoreCase(key)) {
        testonborrow = Boolean.getBoolean(value);
    }
}

From source file:com.netflix.config.ConfigurationManager.java

private static void registerConfigBean() {
    if (Boolean.getBoolean(DynamicPropertyFactory.ENABLE_JMX)) {
        try {//from w  ww.ja  v  a 2s.com
            configMBean = ConfigJMXManager.registerConfigMbean(instance);
        } catch (Exception e) {
            logger.error("Unable to register with JMX", e);
        }
    }
}

From source file:org.sonar.plugins.php.pmd.PhpmdConfiguration.java

/**
 * @see org.sonar.plugins.php.core.AbstractPhpPluginConfiguration #shouldRunDefault()
 * @deprecated/*from  w ww  .  j a  v a 2s.c  o  m*/
 */
@Override
protected boolean shouldRunDefault() {
    return Boolean.getBoolean(PHPMD_DEFAULT_SHOULD_RUN);
}

From source file:org.apache.juneau.rest.client.RestClient.java

/**
 * Calls {@link CloseableHttpClient#close()} on the underlying {@link CloseableHttpClient}.
 * It's good practice to call this method after the client is no longer used.
 *
 * @throws IOException//from  w  w w .  j  ava2 s .c  o m
 */
public void close() throws IOException {
    isClosed = true;
    if (httpClient != null && !keepHttpClientOpen)
        httpClient.close();
    if (executorService != null && executorServiceShutdownOnClose)
        executorService.shutdown();
    if (Boolean.getBoolean("org.apache.juneau.rest.client.RestClient.trackLifecycle"))
        closedStack = Thread.currentThread().getStackTrace();
}

From source file:colt.nicity.performance.agent.LatentHttpPump.java

public void start() {
    ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
    scheduledExecutorService.scheduleWithFixedDelay(() -> {
        try {/* ww w  .  ja v  a 2  s  .c  o  m*/
            final long now = System.currentTimeMillis();
            Boolean enabled = latency.getLatentGraph(this.enabled.get()).latentDepths((from, to) -> {
                // TODO batching
                try {
                    JSONObject sample = new JSONObject();
                    sample.put("clusterName", clusterName);
                    sample.put("serviceName", serviceName);
                    sample.put("serviceVersion", serviceVersion);
                    sample.put("sampleTimestampEpochMillis", now);
                    sample.put("from", latentJson(from));
                    sample.put("to", latentJson(to));
                    HttpResponse postJson = httpClient.postJson("/profile/latents", sample.toJSONString());
                    if (postJson.getStatusCode() >= 200 && postJson.getStatusCode() < 300) {
                        String response = new String(postJson.getResponseBody());
                        return Boolean.getBoolean(response);
                    } else {
                        return null;
                    }
                } catch (Exception x) {
                    //if (verbose) {
                    //System.out.println("Latent Service is inaccessible. "+x.getMessage());
                    //}
                    return null;
                }

            });

            if (enabled != null) {
                this.enabled.set(enabled);
            }

        } catch (Throwable t) {
            t.printStackTrace();
        }
    }, 5, 5, TimeUnit.SECONDS);
}

From source file:org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration.java

protected void configureArchaius(ConfigurableEnvironmentConfiguration envConfig) {
    if (initialized.compareAndSet(false, true)) {
        String appName = this.env.getProperty("spring.application.name");
        if (appName == null) {
            appName = "application";
            log.warn("No spring.application.name found, defaulting to 'application'");
        }//from   w ww.  j ava  2  s .c  o m
        System.setProperty(DeploymentContext.ContextKey.appId.getKey(), appName);

        ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();

        // support to add other Configurations (Jdbc, DynamoDb, Zookeeper, jclouds,
        // etc...)
        if (externalConfigurations != null) {
            for (AbstractConfiguration externalConfig : externalConfigurations) {
                config.addConfiguration(externalConfig);
            }
        }
        config.addConfiguration(envConfig, ConfigurableEnvironmentConfiguration.class.getSimpleName());

        // below come from ConfigurationManager.createDefaultConfigInstance()
        DynamicURLConfiguration defaultURLConfig = new DynamicURLConfiguration();
        try {
            config.addConfiguration(defaultURLConfig, URL_CONFIG_NAME);
        } catch (Throwable ex) {
            log.error("Cannot create config from " + defaultURLConfig, ex);
        }

        // TODO: sys/env above urls?
        if (!Boolean.getBoolean(DISABLE_DEFAULT_SYS_CONFIG)) {
            SystemConfiguration sysConfig = new SystemConfiguration();
            config.addConfiguration(sysConfig, SYS_CONFIG_NAME);
        }
        if (!Boolean.getBoolean(DISABLE_DEFAULT_ENV_CONFIG)) {
            EnvironmentConfiguration environmentConfiguration = new EnvironmentConfiguration();
            config.addConfiguration(environmentConfiguration, ENV_CONFIG_NAME);
        }

        ConcurrentCompositeConfiguration appOverrideConfig = new ConcurrentCompositeConfiguration();
        config.addConfiguration(appOverrideConfig, APPLICATION_PROPERTIES);
        config.setContainerConfigurationIndex(config.getIndexOfConfiguration(appOverrideConfig));

        addArchaiusConfiguration(config);
    } else {
        // TODO: reinstall ConfigurationManager
        log.warn("Netflix ConfigurationManager has already been installed, unable to re-install");
    }
}

From source file:org.apache.maven.surefire.its.fixture.MavenLauncher.java

public OutputValidator executeCurrentGoals() {

    String userLocalRepo = System.getProperty("user.localRepository");
    String testBuildDirectory = System.getProperty("testBuildDirectory");
    boolean useInterpolatedSettings = Boolean.getBoolean("useInterpolatedSettings");

    try {// w  w w.  jav  a 2s  .c o  m
        if (useInterpolatedSettings) {
            File interpolatedSettings = new File(testBuildDirectory, "interpolated-settings");

            if (!interpolatedSettings.exists()) {
                // hack "a la" invoker plugin to download dependencies from local repo
                // and not download from central

                Map<String, String> values = new HashMap<String, String>(1);
                values.put("localRepositoryUrl", toUrl(userLocalRepo));
                StrSubstitutor strSubstitutor = new StrSubstitutor(values);

                String fileContent = FileUtils.fileRead(new File(testBuildDirectory, "settings.xml"));

                String filtered = strSubstitutor.replace(fileContent);

                FileUtils.fileWrite(interpolatedSettings.getAbsolutePath(), filtered);

            }

            addCliOption("-s " + interpolatedSettings.getCanonicalPath());
        }
        getVerifier().setCliOptions(cliOptions);

        getVerifier().executeGoals(goals, envvars);
        return getValidator();
    } catch (IOException e) {
        throw new SurefireVerifierException(e.getMessage(), e);
    } catch (VerificationException e) {
        throw new SurefireVerifierException(e.getMessage(), e);
    } finally {
        getVerifier().resetStreams();
    }
}

From source file:org.limewire.mojito.io.MessageDispatcherImpl.java

@Override
public void start() {
    synchronized (lock) {
        if (!isBound()) {
            throw new IllegalStateException("MessageDispatcher is not bound");
        }//from  w ww.  jav a 2 s . com

        if (!running) {
            accepting = true;
            running = true;

            thread = context.getDHTExecutorService().getThreadFactory().newThread(this);
            thread.setName(context.getName() + "-MessageDispatcherThread");
            thread.setDaemon(Boolean.getBoolean("com.limegroup.mojito.io.MessageDispatcherIsDaemon"));
            thread.start();

            Runnable startup = new Runnable() {
                public void run() {
                    synchronized (lock) {
                        try {
                            MessageDispatcherImpl.super.start();
                        } finally {
                            lock.notifyAll();
                        }
                    }
                }
            };

            process(startup);

            try {
                lock.wait(WAIT_ON_LOCK);
            } catch (InterruptedException err) {
                LOG.error("InterruptedException", err);
            }
        }
    }
}