public ResultsLog( Tracker tracker ) throws IOException { this.tracker = tracker; File defaultFile = File.createTempFile( tracker.getTestClass().getCanonicalName(), "log" ); LOG.info( "Default results log file path = {}", defaultFile.getAbsolutePath() ); resultsFile = DynamicPropertyFactory.getInstance(). getStringProperty( RESULTS_FILE_KEY, defaultFile.getAbsolutePath() ); LOG.info( "Actual results log file path = {}", resultsFile.get() ); waitTime = DynamicPropertyFactory.getInstance().getLongProperty( WAIT_TIME_KEY, 200 ); prettyPrint = DynamicPropertyFactory.getInstance().getBooleanProperty( Constants.PRETTY_PRINT_RESULTS, true ); }
@Override public int getPeerNodeConnectTimeoutMs() { return configInstance.getIntProperty( namespace + "peerNodeConnectTimeoutMs", 1000).get(); }
@Override public double getRenewalPercentThreshold() { return configInstance.getDoubleProperty( namespace + "renewalPercentThreshold", 0.85).get(); }
public DynamicBooleanProperty getDynamicBooleanProperty(String name, Boolean defaultValue) { DynamicBooleanProperty prop = (DynamicBooleanProperty) fastPropMap.get(name); if (prop != null) return prop; prop = DynamicPropertyFactory.getInstance().getBooleanProperty(name, defaultValue); fastPropMap.put(name, prop); return prop; }
public DynamicLongProperty getDynamicLongProperty(String name, long defaultValue) { DynamicLongProperty prop = (DynamicLongProperty) fastPropMap.get(name); if (prop != null) return prop; prop = DynamicPropertyFactory.getInstance().getLongProperty(name, defaultValue); fastPropMap.put(name, prop); return prop; }
public DynamicIntProperty getDynamicIntProperty(String name, int defaultValue) { DynamicIntProperty prop = (DynamicIntProperty) fastPropMap.get(name); if (prop != null) return prop; prop = DynamicPropertyFactory.getInstance().getIntProperty(name, defaultValue); fastPropMap.put(name, prop); return prop; }
@Override public String getHomePageUrl() { return configInstance.getStringProperty(namespace + HOME_PAGE_URL_KEY, null) .get(); }
public UploadConfig() { location = DynamicPropertyFactory.getInstance().getStringProperty(RestConst.UPLOAD_DIR, null).get(); maxFileSize = DynamicPropertyFactory.getInstance().getLongProperty(RestConst.UPLOAD_MAX_FILE_SIZE, -1L).get(); maxSize = DynamicPropertyFactory.getInstance().getLongProperty(RestConst.UPLOAD_MAX_SIZE, -1L).get(); fileSizeThreshold = DynamicPropertyFactory.getInstance().getIntProperty(RestConst.UPLOAD_FILE_SIZE_THRESHOLD, 0) .get(); }
@Override public boolean shouldUseReadOnlyResponseCache() { return configInstance.getBooleanProperty( namespace + "shouldUseReadOnlyResponseCache", true).get(); }
@Override public String resolveDeploymentContextBasedVipAddresses(String vipAddressMacro) { if (vipAddressMacro == null) { return null; } String result = vipAddressMacro; Matcher matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); while (matcher.find()) { String key = matcher.group(1); String value = DynamicPropertyFactory.getInstance().getStringProperty(key, "").get(); logger.debug("att:{}", matcher.group()); logger.debug(", att key:{}", key); logger.debug(", att value:{}", value); logger.debug(""); result = result.replaceAll("\\$\\{" + key + "\\}", value); matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); } return result; } }
@Override public boolean enabled() { return DynamicPropertyFactory.getInstance() .getBooleanProperty("servicecomb.loadbalance.filter.status.enabled", true).get(); }
public MetricsBootstrapConfig() { msPollInterval = DynamicPropertyFactory.getInstance().getIntProperty(METRICS_WINDOW_TIME, DEFAULT_METRICS_WINDOW_TIME).get(); if (msPollInterval < 1000) { msPollInterval = 1000; } }
@Override public void onBootEvent(BootEvent event) { if (!EventType.BEFORE_PRODUCER_PROVIDER.equals(event.getEventType())) { return; } TransportClientConfig.setRestTransportClientCls(EdgeRestTransportClient.class); TransportConfig.setRestServerVerticle(EdgeRestServerVerticle.class); String defaultExecutor = DynamicPropertyFactory.getInstance() .getStringProperty(ExecutorManager.KEY_EXECUTORS_DEFAULT, null) .get(); if (defaultExecutor != null) { LOGGER.info("Edge service default executor is {}.", defaultExecutor); return; } // change default to reactive mode Configuration configuration = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource(); configuration.setProperty(ExecutorManager.KEY_EXECUTORS_DEFAULT, ExecutorManager.EXECUTOR_REACTIVE); LOGGER.info("Set ReactiveExecutor to be edge service default executor."); } }
public DynamicStringProperty getDynamicStringProperty(String name, String defaultValue) { DynamicStringProperty prop = (DynamicStringProperty) fastPropMap.get(name); if (prop != null) return prop; prop = DynamicPropertyFactory.getInstance().getStringProperty(name, defaultValue); fastPropMap.put(name, prop); return prop; }
public static void setProperty(String key, Object value) { // ensure have instance DynamicPropertyFactory.getInstance(); ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); config.getConfiguration(0).addProperty(key, value); }
@Override protected void configure() { DynamicPropertyFactory configInstance = com.netflix.config.DynamicPropertyFactory.getInstance(); bind(DynamicPropertyFactory.class).toInstance(configInstance); // the default impl of EurekaInstanceConfig is CloudInstanceConfig, which we only want in an AWS // environment. Here we override that by binding MyDataCenterInstanceConfig to EurekaInstanceConfig. bind(EurekaInstanceConfig.class).to(MyDataCenterInstanceConfig.class); // (DiscoveryClient optional bindings) bind the optional event bus // bind(EventBus.class).to(EventBusImpl.class).in(Scopes.SINGLETON); } })
private void initDynamicProperties(IClientConfig clientConfig) { if (clientConfig != null) { triggeringLoad = DynamicPropertyFactory.getInstance().getDoubleProperty( "ZoneAwareNIWSDiscoveryLoadBalancer." + clientConfig.getClientName() + ".triggeringLoadPerServerThreshold", 0.2d); triggeringBlackoutPercentage = DynamicPropertyFactory.getInstance().getDoubleProperty( "ZoneAwareNIWSDiscoveryLoadBalancer." + clientConfig.getClientName() + ".avoidZoneWithBlackoutPercetage", 0.99999d); } }
/** * Gets the metadata map associated with the instance. The properties that * will be looked up for this will be <code>namespace + ".metadata"</code>. * * <p> * For instance, if the given namespace is <code>eureka.appinfo</code>, the * metadata keys are searched under the namespace * <code>eureka.appinfo.metadata</code>. * </p> */ @Override public Map<String, String> getMetadataMap() { String metadataNamespace = namespace + INSTANCE_METADATA_PREFIX + "."; Map<String, String> metadataMap = new LinkedHashMap<String, String>(); Configuration config = (Configuration) configInstance.getBackingConfigurationSource(); String subsetPrefix = metadataNamespace.charAt(metadataNamespace.length() - 1) == '.' ? metadataNamespace.substring(0, metadataNamespace.length() - 1) : metadataNamespace; for (Iterator<String> iter = config.subset(subsetPrefix).getKeys(); iter.hasNext(); ) { String key = iter.next(); String value = config.getString(subsetPrefix + "." + key); metadataMap.put(key, value); } return metadataMap; }
@Override public long getRetentionTimeInMSInDeltaQueue() { return configInstance.getLongProperty( namespace + "retentionTimeInMSInDeltaQueue", (3 * 60 * 1000)) .get(); }
@Override public String getHealthCheckUrl() { return configInstance.getStringProperty(namespace + HEALTHCHECK_URL_KEY, null) .get(); }