String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCollapserProperties properties = collapserProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder); return hystrixPropertiesStrategy.getCollapserProperties(key, builder);
String cacheKey = hystrixPropertiesStrategy.getCommandPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCommandProperties properties = commandProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getCommandProperties(key, builder); return hystrixPropertiesStrategy.getCommandProperties(key, builder);
String cacheKey = hystrixPropertiesStrategy.getThreadPoolPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixThreadPoolProperties properties = threadPoolProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getThreadPoolProperties(key, builder); return hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
private static HystrixCommandProperties initCommandProperties(HystrixCommandKey commandKey, HystrixPropertiesStrategy propertiesStrategy, HystrixCommandProperties.Setter commandPropertiesDefaults) { if (propertiesStrategy == null) { return HystrixPropertiesFactory.getCommandProperties(commandKey, commandPropertiesDefaults); } else { // used for unit testing return propertiesStrategy.getCommandProperties(commandKey, commandPropertiesDefaults); } }
@Override public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey qualifiedThreadPoolKey, com.netflix.hystrix.HystrixThreadPoolProperties.Setter builder) { if (MultiConfigId.hasMultiSourceId(qualifiedThreadPoolKey)) { return strategies.get(MultiConfigId.readFrom(qualifiedThreadPoolKey)) .getThreadPoolProperties(MultiConfigId.decode(qualifiedThreadPoolKey), builder); } else { return underlying().map(strategy -> strategy.getThreadPoolProperties(qualifiedThreadPoolKey, builder)) .orElseGet(() -> super.getThreadPoolProperties(qualifiedThreadPoolKey, builder)); } }
@Override public HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey collapserKey, com.netflix.hystrix.HystrixCollapserProperties.Setter builder) { return super.getCollapserProperties(collapserKey, builder); }
@Override public String getCommandPropertiesCacheKey(final HystrixCommandKey commandKey, final HystrixCommandProperties.Setter builder) { return underlying().map(strategy -> strategy.getCommandPropertiesCacheKey(commandKey, builder)) .orElseGet(() -> super.getCommandPropertiesCacheKey(commandKey, builder)); }
@Override public String getCollapserPropertiesCacheKey(final HystrixCollapserKey collapserKey, final HystrixCollapserProperties.Setter builder) { return underlying().map(strategy -> strategy.getCollapserPropertiesCacheKey(collapserKey, builder)) .orElseGet(() -> super.getCollapserPropertiesCacheKey(collapserKey, builder)); }
@Override public String getThreadPoolPropertiesCacheKey(final HystrixThreadPoolKey threadPoolKey, final HystrixThreadPoolProperties.Setter builder) { return underlying().map(strategy -> strategy.getThreadPoolPropertiesCacheKey(threadPoolKey, builder)) .orElseGet(() -> super.getThreadPoolPropertiesCacheKey(threadPoolKey, builder)); }
/** * We want this only done once when created in compareAndSet so use an initialize method */ public void initialize() { HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); int coreSize = propertiesStrategy.getTimerThreadPoolProperties().getCorePoolSize().get(); ThreadFactory threadFactory = null; if (!PlatformSpecific.isAppEngineStandardEnvironment()) { threadFactory = new ThreadFactory() { final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(Runnable r) { Thread thread = new Thread(r, "HystrixTimer-" + counter.incrementAndGet()); thread.setDaemon(true); return thread; } }; } else { threadFactory = PlatformSpecific.getAppEngineThreadFactory(); } executor = new ScheduledThreadPoolExecutor(coreSize, threadFactory); initialized = true; }
private static HystrixCommandProperties initCommandProperties(HystrixCommandKey commandKey, HystrixPropertiesStrategy propertiesStrategy, HystrixCommandProperties.Setter commandPropertiesDefaults) { if (propertiesStrategy == null) { return HystrixPropertiesFactory.getCommandProperties(commandKey, commandPropertiesDefaults); } else { // used for unit testing return propertiesStrategy.getCommandProperties(commandKey, commandPropertiesDefaults); } }
@Override public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, com.netflix.hystrix.HystrixThreadPoolProperties.Setter builder) { return this.beanMapping.getBeanKey(threadPoolKey) .flatMap(beanKey -> createThreadPoolProperties(beanKey, threadPoolKey, builder)) .orElse(super.getThreadPoolProperties(threadPoolKey, builder)); }
@Override public HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey collapserKey, com.netflix.hystrix.HystrixCollapserProperties.Setter builder) { return HystrixPropertiesStrategyDefault.getInstance() .getCollapserProperties(collapserKey, builder); }
/** * We want this only done once when created in compareAndSet so use an initialize method */ public void initialize() { HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); int coreSize = propertiesStrategy.getTimerThreadPoolProperties().getCorePoolSize().get(); ThreadFactory threadFactory = null; if (!PlatformSpecific.isAppEngineStandardEnvironment()) { threadFactory = new ThreadFactory() { final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(Runnable r) { Thread thread = new Thread(r, "HystrixTimer-" + counter.incrementAndGet()); thread.setDaemon(true); return thread; } }; } else { threadFactory = PlatformSpecific.getAppEngineThreadFactory(); } executor = new ScheduledThreadPoolExecutor(coreSize, threadFactory); initialized = true; }
String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCollapserProperties properties = collapserProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder); return hystrixPropertiesStrategy.getCollapserProperties(key, builder);
String cacheKey = hystrixPropertiesStrategy.getThreadPoolPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixThreadPoolProperties properties = threadPoolProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getThreadPoolProperties(key, builder); return hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
String cacheKey = hystrixPropertiesStrategy.getCommandPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCommandProperties properties = commandProperties.get(cacheKey); properties = hystrixPropertiesStrategy.getCommandProperties(key, builder); return hystrixPropertiesStrategy.getCommandProperties(key, builder);
@Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey qualifiedCommandKey, com.netflix.hystrix.HystrixCommandProperties.Setter builder) { if (MultiConfigId.hasMultiSourceId(qualifiedCommandKey)) { return strategies.get(MultiConfigId.readFrom(qualifiedCommandKey)) .getCommandProperties(MultiConfigId.decode(qualifiedCommandKey), builder); } else { return underlying().map(strategy -> strategy.getCommandProperties(qualifiedCommandKey, builder)) .orElseGet(() -> super.getCommandProperties(qualifiedCommandKey, builder)); } }
@Override public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, com.netflix.hystrix.HystrixThreadPoolProperties.Setter builder) { return this.strategyMapping.getHystrixStrategies(threadPoolKey) .getHystrixPropertiesStrategy() .getThreadPoolProperties(threadPoolKey, builder); }
@Override public HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey qualifiedCollapserKey, com.netflix.hystrix.HystrixCollapserProperties.Setter builder) { if (MultiConfigId.hasMultiSourceId(qualifiedCollapserKey)) { return strategies.get(MultiConfigId.readFrom(qualifiedCollapserKey)) .getCollapserProperties(MultiConfigId.decode(qualifiedCollapserKey), builder); } else { return underlying().map(strategy -> strategy.getCollapserProperties(qualifiedCollapserKey, builder)) .orElseGet(() -> super.getCollapserProperties(qualifiedCollapserKey, builder)); } }