当前位置: 首页>>代码示例>>Java>>正文


Java DynamicProperty类代码示例

本文整理汇总了Java中com.netflix.config.DynamicProperty的典型用法代码示例。如果您正苦于以下问题:Java DynamicProperty类的具体用法?Java DynamicProperty怎么用?Java DynamicProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DynamicProperty类属于com.netflix.config包,在下文中一共展示了DynamicProperty类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initConfig

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private void initConfig(OperationMeta operationMeta, String key) {
  if (watchedKeySet.contains(key)) {
    return;
  }

  watchedKeySet.add(key);

  String configKey = Config.CONSUMER_LIMIT_KEY_PREFIX + key;
  DynamicProperty property = DynamicProperty.getInstance(configKey);
  initQpsLimit(key, getIntegerLimitProperty(property));

  property.addCallback(() -> {
    updateQpsLimit(key, getIntegerLimitProperty(property));
    QpsController qpsController = findReference(operationMeta);

    objMap.put(operationMeta.getMicroserviceQualifiedName(), qpsController);
  });
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:ConsumerQpsControllerManager.java

示例2: getOrCreate

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
@Override
public QpsController getOrCreate(String keyOwner) {
  if (keyOwner == null) {
    if (globalQpsController == null) {
      synchronized (lockObj) {
        if (globalQpsController == null) {
          DynamicProperty property =
              DynamicProperty.getInstance(Config.PROVIDER_LIMIT_KEY_GLOBAL);
          globalQpsController = new QpsController(keyOwner, getIntegerLimitProperty(property));
          property.addCallback(() -> {
            globalQpsController.setQpsLimit(getIntegerLimitProperty(property));
          });
        }
      }
    }
    return globalQpsController;
  } else {
    return super.getOrCreate(keyOwner);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:21,代码来源:ProviderQpsControllerManager.java

示例3: initConfig

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private void initConfig(String key) {
  if (watchedKeySet.contains(key)) {
    return;
  }

  watchedKeySet.add(key);

  String configKey = Config.PROVIDER_LIMIT_KEY_PREFIX + key;
  DynamicProperty property = DynamicProperty.getInstance(configKey);
  initQpsLimit(key, getIntegerLimitProperty(property));

  property.addCallback(() -> {
    updateQpsLimit(key, getIntegerLimitProperty(property));
    QpsController qpsController = findReference(key);

    objMap.put(key, qpsController);
  });
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:ProviderQpsControllerManager.java

示例4: getResponse

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private Observable<HttpClientResponse<ByteBuf>> getResponse(String externalHealthCheckURL) {
    String host = "localhost";
    int port = DEFAULT_APPLICATION_PORT;
    String path = "/healthcheck";
    try {
        URL url = new URL(externalHealthCheckURL);
        host = url.getHost();
        port = url.getPort();
        path = url.getPath();
    } catch (MalformedURLException e) {
        //continue
    }
    Integer timeout = DynamicProperty.getInstance("prana.host.healthcheck.timeout").getInteger(DEFAULT_CONNECTION_TIMEOUT);
    HttpClient<ByteBuf, ByteBuf> httpClient = RxNetty.<ByteBuf, ByteBuf>newHttpClientBuilder(host, port)
            .pipelineConfigurator(PipelineConfigurators.<ByteBuf, ByteBuf>httpClientConfigurator())
            .channelOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, timeout)
            .build();
    return httpClient.submit(HttpClientRequest.createGet(path));

}
 
开发者ID:Netflix,项目名称:Prana,代码行数:21,代码来源:HealthCheckHandler.java

示例5: getProperty

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
protected Object getProperty(String key) {
    if (enableDynamicProperties) {
        String dynamicValue = null;
        DynamicStringProperty dynamicProperty = dynamicProperties.get(key);
        if (dynamicProperty != null) {
            dynamicValue = dynamicProperty.get();
        }
        if (dynamicValue == null) {
            dynamicValue = DynamicProperty.getInstance(getConfigKey(key)).getString();
            if (dynamicValue == null) {
                dynamicValue = DynamicProperty.getInstance(getDefaultPropName(key)).getString();
            }
        }
        if (dynamicValue != null) {
            return dynamicValue;
        }
    }
    return properties.get(key);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:20,代码来源:DefaultClientConfigImpl.java

示例6: getIntegerLimitProperty

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private Integer getIntegerLimitProperty(DynamicProperty property) {
  try {
    return property.getInteger();
  } catch (IllegalArgumentException e) {
    LOGGER.error(e.getMessage());
    return null;
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ConsumerQpsControllerManager.java

示例7: close

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
@PreDestroy
public void close() {
	if (defaultURLConfig != null) {
		defaultURLConfig.stopLoading();
	}
	setStatic(ConfigurationManager.class, "instance", null);
	setStatic(ConfigurationManager.class, "customConfigurationInstalled", false);
	setStatic(DynamicPropertyFactory.class, "config", null);
	setStatic(DynamicPropertyFactory.class, "initializedWithDefaultConfig", false);
	setStatic(DynamicProperty.class, "dynamicPropertySupportImpl", null);
	initialized.compareAndSet(true, false);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:13,代码来源:ArchaiusAutoConfiguration.java

示例8: handle

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
@Override
Observable<Void> handle(final Context context) {
    String externalHealthCheckURL = DynamicProperty.getInstance("prana.host.healthcheck.url")
            .getString(DEFAULT_HEALTHCHECK_ENDPOINT);
    context.setHeader("Content-type", DEFAULT_CONTENT_TYPE);
    if (Strings.isNullOrEmpty(externalHealthCheckURL)) {
        return context.sendSimple(DEFAULT_OK_HEALTH);
    } else {
        return getResponse(externalHealthCheckURL).flatMap(new Func1<HttpClientResponse<ByteBuf>, Observable<Void>>() {
            @Override
            public Observable<Void> call(HttpClientResponse<ByteBuf> response) {
                if (response.getStatus().code() == HttpResponseStatus.OK.code()) {
                    context.sendSimple(DEFAULT_OK_HEALTH);
                } else {
                    context.sendError(HttpResponseStatus.SERVICE_UNAVAILABLE, DEFAULT_FAIL_HEALTH);
                }
                return DEFAULT_NOOP_RESPONSE;
            }
        }).onErrorFlatMap(new Func1<OnErrorThrowable, Observable<Void>>() {
            @Override
            public Observable<Void> call(OnErrorThrowable onErrorThrowable) {
                context.sendError(HttpResponseStatus.SERVICE_UNAVAILABLE, DEFAULT_FAIL_HEALTH);
                return DEFAULT_NOOP_RESPONSE;
            }
        });
    }
}
 
开发者ID:Netflix,项目名称:Prana,代码行数:28,代码来源:HealthCheckHandler.java

示例9: handle

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
@Override
Observable<Void> handle(Context context) {
    Map<String, String> properties = new HashMap<>();
    List<String> ids = context.getQueryParams(ID_QUERY_PARAMETER);
    for (String id : ids) {
        String property = DynamicProperty.getInstance(id).getString(null);
        properties.put(id, property);
    }
    return context.send(properties);
}
 
开发者ID:Netflix,项目名称:Prana,代码行数:11,代码来源:DynamicPropertiesHandler.java

示例10: DynamicPropertyBasedPoolStrategy

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
public DynamicPropertyBasedPoolStrategy(final int maxConnections, String propertyName) {
    super(maxConnections);
    poolSizeProperty = DynamicProperty.getInstance(propertyName);
    setMaxConnections(poolSizeProperty.getInteger(maxConnections));
    poolSizeProperty.addCallback(new Runnable() {
        @Override
        public void run() {
            setMaxConnections(poolSizeProperty.getInteger(maxConnections));
        };
    });
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:12,代码来源:DynamicPropertyBasedPoolStrategy.java

示例11: PropertyFactory

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private PropertyFactory(String prefix, String propName, String workerName) {
	this.global = DynamicProperty.getInstance(prefix + "." + propName);
	this.local = DynamicProperty.getInstance(prefix + "." + workerName + "." + propName);
}
 
开发者ID:Netflix,项目名称:conductor,代码行数:5,代码来源:PropertyFactory.java

示例12: isCloudDataCenter

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
private boolean isCloudDataCenter() {
    return "cloud".equals(DynamicProperty.getInstance("eureka.datacenter").getString());
}
 
开发者ID:schibsted,项目名称:ratpack-eureka,代码行数:4,代码来源:EurekaModule.java

示例13: DynamicListenableSupplier

import com.netflix.config.DynamicProperty; //导入依赖的package包/类
DynamicListenableSupplier(DynamicProperty prop) {
    this.prop = prop;
}
 
开发者ID:Netflix,项目名称:fabricator,代码行数:4,代码来源:ArchaiusComponentConfiguration.java


注:本文中的com.netflix.config.DynamicProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。