@Override public void start(Configuration conf) { super.start(conf); Integer httpPort = conf.getInteger("codahaleStatsHttpPort", null); if (null != httpPort) { servletReporter = new ServletReporter( getMetrics(), healthCheckRegistry, httpPort); try { servletReporter.start(); } catch (Exception e) { logger.warn("Encountered error on starting the codahale metrics servlet", e); } } }
private static int getPositiveIntProperty(Configuration configSource, int defaultValue, String... keys) { configSource = guardConfigSource(configSource); if (configSource == null) { return defaultValue; } for (String key : keys) { Integer val = configSource.getInteger(key, null); if (val != null && val <= 0) { LOGGER.warn("Address resover key:{}'s value:{} is not positive, please check!", key, val); continue; } if (val != null) { return val; } } return defaultValue; }
/** * Delegates to the underlying configuration. */ @Override public Integer getInteger(String key, Integer defaultValue) { return config.getInteger(key, defaultValue); }
/** * Delegates to the underlying configuration. */ @Override public Integer getInteger(String key, Integer defaultValue) { return config.getInteger(key, defaultValue); }
@Override public Integer getInteger(final String key, final Integer defaultValue) { return delegate.getInteger(key, defaultValue); }
@Override public Integer getInteger(String key, Integer defaultValue) { return delegate.getInteger(key, defaultValue); }
private static Optional<Integer> getOptionalIntegerFromConf(Configuration configuration, String key) { return Optional.ofNullable(configuration.getInteger(key, null)); }
private static Host getHost(Configuration propertiesReader) { return Host.from(propertiesReader.getString(SPAMASSASSIN_HOST, DEFAULT_HOST), propertiesReader.getInteger(SPAMASSASSIN_PORT, DEFAULT_PORT)); } }
@Override public Integer getInteger(final String key, final Integer defaultValue) { return configuration.getInteger(childNodeKey(key), defaultValue); }
public Integer getClosedStateId() { LOG.debug("getting closed state ID: {}", getProperties().getInteger("otrs.closedstateid", 2)); return getProperties().getInteger("otrs.closedstateid", 2); }
public Integer getClosedStateId() { LOG.debug("getting closed state ID: {}", getProperties().getInteger("otrs.closedstateid", 2)); return getProperties().getInteger("otrs.closedstateid", 2); }
public Integer getOpenStateId() { return getProperties().getInteger("otrs.openstateid", 1); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues() { Assert.assertThat(cfg, is(notNullValue())); final Configuration config = cfg.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }
@Test public void loadIntValues2() { Assert.assertThat(cfg2, is(notNullValue())); final Configuration config = cfg2.getConfiguration(); Assert.assertThat(config, is(notNullValue())); final Integer s_cfg1 = config.getInteger("int-null-value", null); Assert.assertThat(s_cfg1, is(nullValue())); final int s_cfg2 = config.getInt("int-value"); Assert.assertThat(s_cfg2, is(12345)); }