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


Java DynamicIntProperty.get方法代码示例

本文整理汇总了Java中com.netflix.config.DynamicIntProperty.get方法的典型用法代码示例。如果您正苦于以下问题:Java DynamicIntProperty.get方法的具体用法?Java DynamicIntProperty.get怎么用?Java DynamicIntProperty.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.config.DynamicIntProperty的用法示例。


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

示例1: ScheduledThreadPoolExectuorWithDynamicSize

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public ScheduledThreadPoolExectuorWithDynamicSize(final DynamicIntProperty corePoolSize, ThreadFactory threadFactory) {
    super(corePoolSize.get(), threadFactory);
    corePoolSize.addCallback(new Runnable() {
        public void run() {
            setCorePoolSize(corePoolSize.get());
        }
    });
    shutdownThread = new Thread(new Runnable() {
        public void run() {
            shutdown();
            if (shutdownThread != null) {
                try {
                    Runtime.getRuntime().removeShutdownHook(shutdownThread);
                } catch (IllegalStateException ise) { // NOPMD
                }
            }
        }
    });
    Runtime.getRuntime().addShutdownHook(shutdownThread);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:21,代码来源:ScheduledThreadPoolExectuorWithDynamicSize.java

示例2: getWorkerPoolSize

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getWorkerPoolSize() {
  String workerPoolSizeKey = "cse.service.registry.client.workerPoolSize";
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty(workerPoolSizeKey, 1);
  int workerPoolSize = property.get();
  if (workerPoolSize <= 0) {
    int nAvailableProcessors = Runtime.getRuntime().availableProcessors();
    LOGGER.warn("The property `{}` must be positive integer, fallback to use number of available processors: {}",
        workerPoolSizeKey,
        nAvailableProcessors);
    return nAvailableProcessors;
  }
  return workerPoolSize;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:16,代码来源:ServiceRegistryConfig.java

示例3: getConnectionTimeout

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getConnectionTimeout() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.client.timeout.connection", DEFAULT_TIMEOUT_IN_MS);
  int timeout = property.get();
  return timeout < 0 ? DEFAULT_TIMEOUT_IN_MS : timeout;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:8,代码来源:ServiceRegistryConfig.java

示例4: getIdleConnectionTimeout

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getIdleConnectionTimeout() {
  // connection pool idle timeout based on client heart beat interval. Heart beat default value is 30.
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.client.timeout.idle", DEFAULT_TIMEOUT_IN_SECONDS * 2);
  int timeout = property.get();
  return timeout < 1 ? DEFAULT_TIMEOUT_IN_SECONDS * 2 : timeout;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ServiceRegistryConfig.java

示例5: getRequestTimeout

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getRequestTimeout() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.client.timeout.request", DEFAULT_REQUEST_TIMEOUT_IN_MS);
  int timeout = property.get();
  return timeout < 1 ? DEFAULT_REQUEST_TIMEOUT_IN_MS : timeout;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:8,代码来源:ServiceRegistryConfig.java

示例6: getHeartBeatRequestTimeout

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getHeartBeatRequestTimeout() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.client.timeout.heartbeat", DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS);
  int timeout = property.get();
  return timeout < 1 ? DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS : timeout;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:8,代码来源:ServiceRegistryConfig.java

示例7: getHeartbeatInterval

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getHeartbeatInterval() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.instance.healthCheck.interval",
              DEFAULT_CHECK_INTERVAL_IN_S);
  int interval = property.get();
  return interval < 0 ? DEFAULT_CHECK_INTERVAL_IN_S : interval;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ServiceRegistryConfig.java

示例8: getInstancePullInterval

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getInstancePullInterval() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.instance.pull.interval",
              DEFAULT_CHECK_INTERVAL_IN_S);
  int interval = property.get();
  return interval < 0 ? DEFAULT_CHECK_INTERVAL_IN_S : interval;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ServiceRegistryConfig.java

示例9: getResendHeartBeatTimes

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getResendHeartBeatTimes() {
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.instance.healthCheck.times",
              DEFAULT_CHECK_TIMES);
  int times = property.get();
  return times < 0 ? DEFAULT_CHECK_TIMES : times;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ServiceRegistryConfig.java

示例10: ServiceCheck

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public ServiceCheck() {
    DynamicStringProperty appHost = DynamicPropertyFactory.getInstance().getStringProperty("registration.appHost", "localhost");
    DynamicIntProperty appPort = DynamicPropertyFactory.getInstance().getIntProperty("registration.appPort", DEFAULT_APP_PORT);
    DynamicStringProperty appHealthcheckPath = DynamicPropertyFactory.getInstance().getStringProperty("registration.appHealthcheckPatht", "/");
    DynamicBooleanProperty appPortSecure = DynamicPropertyFactory.getInstance().getBooleanProperty("registration.appPortSecure", false);
    DynamicIntProperty checkTimeout = DynamicPropertyFactory.getInstance().getIntProperty("registration.checkTimeout", DEFAULT_CHECK_TIMEOUT);

    this.appHost = appHost.get();
    this.appPort = appPort.get();
    this.appHealthcheckPath = appHealthcheckPath.get();
    this.appPortSecure = appPortSecure.get();
    this.checkTimeout = checkTimeout.get();
}
 
开发者ID:schibsted,项目名称:triathlon,代码行数:14,代码来源:HealthCheck.java

示例11: getCache

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
private Cache<String, Integer> getCache(String appName) {

        DynamicBooleanProperty throttleFlag = throttleMap.get(appName);
        if(throttleFlag == null) {
            throttleFlag = EVCacheConfig.getInstance().getDynamicBooleanProperty("EVCacheThrottler." + appName + ".throttle.hot.keys", false);
            throttleMap.put(appName, throttleFlag);
        }
        if(log.isDebugEnabled()) log.debug("Throttle hot keys : " + throttleFlag);

        if(!throttleFlag.get()) {
            return null;
        }

        Cache<String, Integer> cache = cacheMap.get(appName);
        if(cache != null) return cache; 

        final DynamicIntProperty _cacheDuration = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheThrottler." + appName + ".inmemory.expire.after.write.duration.ms", 10000);
        final DynamicIntProperty _exireAfterAccessDuration = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheThrottler." + appName + ".inmemory.expire.after.access.duration.ms", 10000);
        final DynamicIntProperty _cacheSize = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheThrottler." + appName + ".inmemory.cache.size", 100);

        CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder().recordStats();
        if(_cacheSize.get() > 0) {
            builder = builder.maximumSize(_cacheSize.get());
        }
        if(_exireAfterAccessDuration.get() > 0) {
            builder = builder.expireAfterAccess(_exireAfterAccessDuration.get(), TimeUnit.MILLISECONDS);
        } else if(_cacheDuration.get() > 0) {
            builder = builder.expireAfterWrite(_cacheDuration.get(), TimeUnit.MILLISECONDS);
        }  
        cache = builder.build();
        cacheMap.put(appName, cache);
        return cache;
    }
 
开发者ID:Netflix,项目名称:EVCache,代码行数:34,代码来源:HotKeyListener.java

示例12: getIntProperty

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
@Override
public int getIntProperty(String propertyName, IntConsumer consumer, int defaultValue) {
  DynamicIntProperty prop = propertyFactoryInstance().getIntProperty(propertyName, defaultValue);
  prop.addCallback(() -> consumer.accept(prop.get()));
  return prop.get();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:7,代码来源:DynamicPropertiesImpl.java

示例13: getIdleWatchTimeout

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public int getIdleWatchTimeout() {
  // watch idle timeout based on SC PING/PONG interval. SC default value is 30.
  DynamicIntProperty property =
      DynamicPropertyFactory.getInstance()
          .getIntProperty("cse.service.registry.client.timeout.watch", DEFAULT_TIMEOUT_IN_SECONDS * 2);
  int timeout = property.get();
  return timeout < 1 ? DEFAULT_TIMEOUT_IN_SECONDS * 2 : timeout;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ServiceRegistryConfig.java

示例14: getThreadCount

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public static int getThreadCount() {
  DynamicIntProperty address =
      DynamicPropertyFactory.getInstance().getIntProperty("cse.rest.server.thread-count", 1);
  return address.get();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:6,代码来源:TransportConfig.java

示例15: getServerThreadCount

import com.netflix.config.DynamicIntProperty; //导入方法依赖的package包/类
public static int getServerThreadCount() {
  DynamicIntProperty address =
      DynamicPropertyFactory.getInstance().getIntProperty("cse.highway.server.thread-count", 1);
  return address.get();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:6,代码来源:HighwayConfig.java


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