Java Code Examples for com.netflix.config.DynamicBooleanProperty#get()
The following examples show how to use
com.netflix.config.DynamicBooleanProperty#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitializeServletListener.java From s2g-zuul with MIT License | 5 votes |
private void registerEureka() { DynamicBooleanProperty eurekaEnabled = DynamicPropertyFactory.getInstance().getBooleanProperty("eureka.enabled", true); if (!eurekaEnabled.get()) return; EurekaInstanceConfig eurekaInstanceConfig = new PropertiesInstanceConfig() { }; ConfigurationManager.getConfigInstance().setProperty("eureka.statusPageUrl","http://"+ getTurbineInstance()); DiscoveryManager.getInstance().initComponent(eurekaInstanceConfig, new DefaultEurekaClientConfig()); final DynamicStringProperty serverStatus = DynamicPropertyFactory.getInstance() .getStringProperty("server." + IPUtil.getLocalIP() + ".status", "up"); DiscoveryManager.getInstance().getDiscoveryClient().registerHealthCheckCallback(new HealthCheckCallback() { @Override public boolean isHealthy() { return serverStatus.get().toLowerCase().equals("up"); } }); String version = String.valueOf(System.currentTimeMillis()); String group = ConfigurationManager.getConfigInstance().getString("server.group", "default"); String dataCenter = ConfigurationManager.getConfigInstance().getString("server.data-center", "default"); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("version", version); metadata.put("group", group); metadata.put("dataCenter", dataCenter); String turbineInstance = getTurbineInstance(); if (turbineInstance != null) { metadata.put("turbine.instance", turbineInstance); } ApplicationInfoManager.getInstance().registerAppMetadata(metadata); }
Example 2
Source File: ServiceRegistryConfigBuilder.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public boolean isRegistryAutoDiscovery() { DynamicBooleanProperty property = DynamicPropertyFactory.getInstance() .getBooleanProperty("servicecomb.service.registry.autodiscovery", false); return property.get(); }
Example 3
Source File: ServiceRegistryConfigBuilder.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public boolean isAlwaysOverrideSchema() { DynamicBooleanProperty property = DynamicPropertyFactory.getInstance() .getBooleanProperty("servicecomb.service.registry.instance.alwaysOverrideSchema", false); return property.get(); }
Example 4
Source File: ServiceRegistryConfigBuilder.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public boolean isPreferIpAddress() { DynamicBooleanProperty property = DynamicPropertyFactory.getInstance() .getBooleanProperty("servicecomb.service.registry.instance.preferIpAddress", false); return property.get(); }
Example 5
Source File: ServiceRegistryConfigBuilder.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public boolean isWatch() { DynamicBooleanProperty property = DynamicPropertyFactory.getInstance() .getBooleanProperty("servicecomb.service.registry.instance.watch", true); return property.get(); }
Example 6
Source File: InitializeServletListener.java From s2g-zuul with MIT License | 4 votes |
private void updateInstanceStatusToEureka() { DynamicBooleanProperty eurekaEnabled = DynamicPropertyFactory.getInstance().getBooleanProperty("eureka.enabled", true); if (!eurekaEnabled.get()) return; ApplicationInfoManager.getInstance().setInstanceStatus(InstanceInfo.InstanceStatus.UP); }
Example 7
Source File: DynamicPropertiesImpl.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Override public boolean getBooleanProperty(String propertyName, Consumer<Boolean> consumer, boolean defaultValue) { DynamicBooleanProperty prop = propertyFactoryInstance().getBooleanProperty(propertyName, defaultValue); prop.addCallback(() -> consumer.accept(prop.get())); return prop.get(); }
Example 8
Source File: ConfigSubscriber.java From AsuraFramework with Apache License 2.0 | 4 votes |
@Override public boolean getBoolean(String key, boolean defaultValue, Runnable callback) { final DynamicBooleanProperty property = DynamicPropertyFactory.getInstance().getBooleanProperty(key, defaultValue, callback); return property.get(); }
Example 9
Source File: SurgicalDebugFilter.java From zuul with Apache License 2.0 | 3 votes |
@Override public boolean shouldFilter(HttpRequestMessage request) { DynamicBooleanProperty debugFilterShutoff = new DynamicBooleanProperty(ZuulConstants.ZUUL_DEBUGFILTERS_DISABLED, false); if (debugFilterShutoff.get()) return false; if (isDisabled()) return false; String isSurgicalFilterRequest = request.getHeaders().getFirst(ZuulHeaders.X_ZUUL_SURGICAL_FILTER); // dont' apply filter if it was already applied boolean notAlreadyFiltered = !("true".equals(isSurgicalFilterRequest)); return notAlreadyFiltered && patternMatches(request); }
Example 10
Source File: ConfigSubscriber.java From AsuraFramework with Apache License 2.0 | 2 votes |
/** * @param key * 配置项的key * @param defaultValue * 如果取回的配置项值为空, 应该返回的默认值 * * @return 配置项的值 */ @Override public boolean getBoolean(String key, boolean defaultValue) { final DynamicBooleanProperty property = DynamicPropertyFactory.getInstance().getBooleanProperty(key, defaultValue); return property.get(); }