com.netflix.hystrix.HystrixThreadPoolProperties Java Examples
The following examples show how to use
com.netflix.hystrix.HystrixThreadPoolProperties.
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: HelloDegrade.java From TakinRPC with Apache License 2.0 | 6 votes |
private static Setter setter() { HystrixCommandGroupKey groupkey = HystrixCommandGroupKey.Factory.asKey("rpc"); HystrixCommandKey commandkey = HystrixCommandKey.Factory.asKey("say"); HystrixThreadPoolKey threadpoolkey = HystrixThreadPoolKey.Factory.asKey("hello-1"); HystrixThreadPoolProperties.Setter threadproperties = HystrixThreadPoolProperties.Setter()// .withCoreSize(20).withKeepAliveTimeMinutes(5).withMaxQueueSize(1000).withQueueSizeRejectionThreshold(100); HystrixCommandProperties.Setter commandproperty = HystrixCommandProperties.Setter()// .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD)// .withFallbackEnabled(true).withFallbackIsolationSemaphoreMaxConcurrentRequests(100)// .withExecutionIsolationThreadInterruptOnFutureCancel(true)// .withExecutionIsolationThreadInterruptOnTimeout(true)// .withExecutionTimeoutEnabled(true).withExecutionTimeoutInMilliseconds(1000); return HystrixCommand.Setter.withGroupKey(groupkey).andCommandKey(commandkey)// .andThreadPoolKey(threadpoolkey).andThreadPoolPropertiesDefaults(threadproperties)// .andCommandPropertiesDefaults(commandproperty); }
Example #2
Source File: HelloBreaker.java From TakinRPC with Apache License 2.0 | 6 votes |
private static Setter setter() { HystrixCommandGroupKey groupkey = HystrixCommandGroupKey.Factory.asKey("rpc"); HystrixCommandKey commandkey = HystrixCommandKey.Factory.asKey("say"); HystrixThreadPoolKey threadpoolkey = HystrixThreadPoolKey.Factory.asKey("hello-1"); HystrixThreadPoolProperties.Setter threadproperties = HystrixThreadPoolProperties.Setter()// .withCoreSize(20).withKeepAliveTimeMinutes(5).withMaxQueueSize(1000).withQueueSizeRejectionThreshold(100); HystrixCommandProperties.Setter commandproperty = HystrixCommandProperties.Setter()// .withCircuitBreakerEnabled(true).withCircuitBreakerForceClosed(false)// .withCircuitBreakerForceOpen(false).withCircuitBreakerErrorThresholdPercentage(50)// .withCircuitBreakerRequestVolumeThreshold(20)// .withCircuitBreakerSleepWindowInMilliseconds(5000); return HystrixCommand.Setter.withGroupKey(groupkey).andCommandKey(commandkey)// .andThreadPoolKey(threadpoolkey).andThreadPoolPropertiesDefaults(threadproperties)// .andCommandPropertiesDefaults(commandproperty); }
Example #3
Source File: HystrixCommandConfigurationTest.java From astrix with Apache License 2.0 | 6 votes |
@Test public void readsDefaultBeanSettingsFromBeanConfiguration() throws Throwable { astrixConfigurer.set(AstrixBeanSettings.CORE_SIZE, AstrixBeanKey.create(Ping.class), 4); astrixConfigurer.set(AstrixBeanSettings.QUEUE_SIZE_REJECTION_THRESHOLD, AstrixBeanKey.create(Ping.class), 6); astrixConfigurer.set(AstrixBeanSettings.TIMEOUT, AstrixBeanKey.create(Ping.class), 100); astrixConfigurer.set(AstrixBeanSettings.MAX_CONCURRENT_REQUESTS, AstrixBeanKey.create(Ping.class), 21); astrixContext.getBean(Ping.class).ping("foo"); HystrixFaultToleranceFactory hystrixFaultTolerance = getFaultTolerance(astrixContext); HystrixCommandProperties pingCommandProperties = getHystrixCommandProperties(hystrixFaultTolerance, Ping.class); HystrixThreadPoolProperties pingThreadPoolProperties = getThreadPoolProperties(hystrixFaultTolerance, Ping.class); assertEquals(100, pingCommandProperties.executionTimeoutInMilliseconds().get().intValue()); assertEquals(21, pingCommandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get().intValue()); assertEquals(4, pingThreadPoolProperties.coreSize().get().intValue()); assertEquals(6, pingThreadPoolProperties.queueSizeRejectionThreshold().get().intValue()); }
Example #4
Source File: TenacityPropertyStore.java From tenacity with Apache License 2.0 | 6 votes |
public static TenacityConfiguration getTenacityConfiguration(TenacityPropertyKey key) { final HystrixCommandProperties commandProperties = TenacityCommand.getCommandProperties(key); final HystrixThreadPoolProperties threadPoolProperties = TenacityCommand.getThreadpoolProperties(key); return new TenacityConfiguration( new ThreadPoolConfiguration( threadPoolProperties.coreSize().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get()), new CircuitBreakerConfiguration( commandProperties.circuitBreakerRequestVolumeThreshold().get(), commandProperties.circuitBreakerSleepWindowInMilliseconds().get(), commandProperties.circuitBreakerErrorThresholdPercentage().get(), commandProperties.metricsRollingStatisticalWindowInMilliseconds().get(), commandProperties.metricsRollingStatisticalWindowBuckets().get()), new SemaphoreConfiguration( commandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get(), commandProperties.fallbackIsolationSemaphoreMaxConcurrentRequests().get()), commandProperties.executionTimeoutInMilliseconds().get(), commandProperties.executionIsolationStrategy().get()); }
Example #5
Source File: GrpcHystrixCommand.java From saluki with Apache License 2.0 | 6 votes |
public GrpcHystrixCommand(String serviceName, String methodName, Boolean isEnabledFallBack) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(serviceName))// .andCommandKey(HystrixCommandKey.Factory.asKey(serviceName + ":" + methodName))// .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withCircuitBreakerRequestVolumeThreshold(20)// 10秒钟内至少19此请求失败,熔断器才发挥起作用 .withCircuitBreakerSleepWindowInMilliseconds(30000)// 熔断器中断请求30秒后会进入半打开状态,放部分流量过去重试 .withCircuitBreakerErrorThresholdPercentage(50)// 错误率达到50开启熔断保护 .withExecutionTimeoutEnabled(false)// 禁用这里的超时 .withFallbackEnabled(isEnabledFallBack))// .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(100) .withAllowMaximumSizeToDivergeFromCoreSize(true).withMaximumSize(Integer.MAX_VALUE))); this.serviceName = serviceName; this.methodName = methodName; this.start = System.currentTimeMillis(); this.rpcContext = new ImmutableTriple<Map<String, String>, Map<String, Object>, Set<Class>>( RpcContext.getContext().getAttachments(), RpcContext.getContext().get(), RpcContext.getContext().getHoldenGroups()); RpcContext.removeContext(); }
Example #6
Source File: MessageInvokeCommandForThreadIsolation.java From pmq with Apache License 2.0 | 5 votes |
public MessageInvokeCommandForThreadIsolation(String consumerGroupName, ConsumerQueueDto pre, List<MessageDto> dtos, ISubscriber iSubscriber) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(consumerGroupName)) .andCommandKey(HystrixCommandKey.Factory.asKey(consumerGroupName + "." + pre.getOriginTopicName())) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(consumerGroupName + "." + pre.getQueueId())) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(pre.getThreadSize())) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() // .withExecutionTimeoutInMilliseconds(pre.getTimeout() * 1000) .withExecutionTimeoutEnabled(true) .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD) .withCircuitBreakerEnabled(false))); this.iSubscriber1 = iSubscriber; this.pre1 = pre; this.dtos = dtos; }
Example #7
Source File: TakinHystrixCommand.java From TakinRPC with Apache License 2.0 | 5 votes |
public TakinHystrixCommand(RemotingContext context) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(context.getProtocol().getDefineClass().getName()))// .andCommandKey(HystrixCommandKey.Factory.asKey(// String.format("%s_%d", context.getProtocol().getMethod(), context.getProtocol().getArgs() == null ? 0 : context.getProtocol().getArgs().length)))// .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()// .withCircuitBreakerRequestVolumeThreshold(20)//10秒钟内至少19此请求失败,熔断器才发挥起作用 .withCircuitBreakerSleepWindowInMilliseconds(30000)//熔断器中断请求30秒后会进入半打开状态,放部分流量过去重试 .withCircuitBreakerErrorThresholdPercentage(50)//错误率达到50开启熔断保护 .withExecutionTimeoutEnabled(false))//使用dubbo的超时,禁用这里的超时 .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(DEFAULT_THREADPOOL_CORE_SIZE)));//线程池为30 this.context = context; logger.info("use TakinHystrixCommand"); }
Example #8
Source File: HelloSemphor.java From TakinRPC with Apache License 2.0 | 5 votes |
private static Setter setter() { HystrixCommandGroupKey groupkey = HystrixCommandGroupKey.Factory.asKey("rpc"); HystrixCommandKey commandkey = HystrixCommandKey.Factory.asKey("say"); HystrixThreadPoolKey threadpoolkey = HystrixThreadPoolKey.Factory.asKey("hello-1"); HystrixThreadPoolProperties.Setter threadproperties = HystrixThreadPoolProperties.Setter()// .withCoreSize(20).withKeepAliveTimeMinutes(5).withMaxQueueSize(1000).withQueueSizeRejectionThreshold(100); HystrixCommandProperties.Setter commandproperty = HystrixCommandProperties.Setter()// .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE)// .withExecutionIsolationSemaphoreMaxConcurrentRequests(10); return HystrixCommand.Setter.withGroupKey(groupkey).andCommandKey(commandkey)// .andThreadPoolKey(threadpoolkey).andThreadPoolPropertiesDefaults(threadproperties)// .andCommandPropertiesDefaults(commandproperty); }
Example #9
Source File: BeanConfigurationPropertiesStrategy.java From astrix with Apache License 2.0 | 5 votes |
@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)); }
Example #10
Source File: PropertiesStrategyDispatcher.java From astrix with Apache License 2.0 | 5 votes |
@Override public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, com.netflix.hystrix.HystrixThreadPoolProperties.Setter builder) { return this.strategyMapping.getHystrixStrategies(threadPoolKey) .getHystrixPropertiesStrategy() .getThreadPoolProperties(threadPoolKey, builder); }
Example #11
Source File: MicrometerMetricsPublisherThreadPool.java From micrometer with Apache License 2.0 | 5 votes |
public MicrometerMetricsPublisherThreadPool( final MeterRegistry meterRegistry, final HystrixThreadPoolKey threadPoolKey, final HystrixThreadPoolMetrics metrics, final HystrixThreadPoolProperties properties, final HystrixMetricsPublisherThreadPool metricsPublisherForThreadPool) { this.meterRegistry = meterRegistry; this.metrics = metrics; this.properties = properties; this.metricsPublisherForThreadPool = metricsPublisherForThreadPool; this.tags = Tags.of("key", threadPoolKey.name()); }
Example #12
Source File: HelloCommand.java From TakinRPC with Apache License 2.0 | 5 votes |
private static Setter setter() { HystrixCommandGroupKey groupkey = HystrixCommandGroupKey.Factory.asKey("rpc"); HystrixCommandKey commandkey = HystrixCommandKey.Factory.asKey("say"); HystrixThreadPoolKey threadpoolkey = HystrixThreadPoolKey.Factory.asKey("hello-1"); HystrixThreadPoolProperties.Setter threadproperties = HystrixThreadPoolProperties.Setter()// .withCoreSize(1).withKeepAliveTimeMinutes(1).withMaxQueueSize(1000).withQueueSizeRejectionThreshold(2); HystrixCommandProperties.Setter commandproperty = HystrixCommandProperties.Setter()// .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD); return HystrixCommand.Setter.withGroupKey(groupkey).andCommandKey(commandkey)// .andThreadPoolKey(threadpoolkey).andThreadPoolPropertiesDefaults(threadproperties)// .andCommandPropertiesDefaults(commandproperty); }
Example #13
Source File: MetadataCommand.java From syndesis with Apache License 2.0 | 5 votes |
MetadataCommand(final MetadataConfigurationProperties configuration, Class<R> type, final Map<String, String> parameters ) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("Meta"))// .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter()// .withCoreSize(configuration.getThreads()))// .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()// .withExecutionTimeoutInMilliseconds(configuration.getTimeout()))); this.parameters = parameters; this.type = type; }
Example #14
Source File: AstrixThreadPoolProperties.java From astrix with Apache License 2.0 | 5 votes |
AstrixThreadPoolProperties(BeanConfiguration beanConfiguration, HystrixThreadPoolKey key, HystrixThreadPoolProperties.Setter builder) { super(key, builder); // We create all these property adaptors here as each and every one results in creation of several temporary String objects. // The alternative to this, to create the adaptors at call-time in the various methods of this class, results in large amounts // of temporary objects and thus heavy GC load in systems with many astrix calls. this.queueSizeRejectionThreshold = new DynamicPropertyAdapter<>(beanConfiguration.get(AstrixBeanSettings.QUEUE_SIZE_REJECTION_THRESHOLD)); this.coreSize = new DynamicPropertyAdapter<>(beanConfiguration.get(AstrixBeanSettings.CORE_SIZE)); this.keepAliveTimeMinutes = new DynamicPropertyAdapter<>(new DynamicIntProperty(1)); this.maxQueueSize = new DynamicPropertyAdapter<>(beanConfiguration.get(MAX_QUEUE_SIZE)); this.metricsRollingStatisticalWindowBuckets = new DynamicPropertyAdapter<>(new DynamicIntProperty(10)); this.metricsRollingStatisticalWindowInMilliseconds = new DynamicPropertyAdapter<>(new DynamicIntProperty(10_000)); }
Example #15
Source File: DubboHystrixCommand.java From dubbox with Apache License 2.0 | 5 votes |
public DubboHystrixCommand(Invoker<?> invoker,Invocation invocation){ super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(invoker.getInterface().getName())) .andCommandKey(HystrixCommandKey.Factory.asKey(String.format("%s_%d", invocation.getMethodName(), invocation.getArguments() == null ? 0 : invocation.getArguments().length))) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withCircuitBreakerRequestVolumeThreshold(20)//10秒钟内至少19此请求失败,熔断器才发挥起作用 .withCircuitBreakerSleepWindowInMilliseconds(30000)//熔断器中断请求30秒后会进入半打开状态,放部分流量过去重试 .withCircuitBreakerErrorThresholdPercentage(50)//错误率达到50开启熔断保护 .withExecutionTimeoutEnabled(false))//使用dubbo的超时,禁用这里的超时 .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(getThreadPoolCoreSize(invoker.getUrl()))));//线程池为30 this.invoker=invoker; this.invocation=invocation; }
Example #16
Source File: ServiceCombConcurrencyStrategy.java From servicecomb-pack with Apache License 2.0 | 5 votes |
@Override public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { return existingConcurrencyStrategy != null ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, threadPoolProperties) : super.getThreadPool(threadPoolKey, threadPoolProperties); }
Example #17
Source File: HystrixConcurrencyStrategyTests.java From servicecomb-pack with Apache License 2.0 | 5 votes |
public TestCircuitBreakerCommand(String name, OmegaContext omegaContext) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ThreadPoolTestGroup")) .andCommandKey(HystrixCommandKey.Factory.asKey("testCommandKey")) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(name)) .andThreadPoolPropertiesDefaults( HystrixThreadPoolProperties.Setter() .withMaxQueueSize(10) .withCoreSize(3) .withMaximumSize(3) ) ); this.omegaContext = omegaContext; }
Example #18
Source File: GetCostCentersCommand.java From cloud-s4-sdk-examples with Apache License 2.0 | 5 votes |
protected GetCostCentersCommand( final ReadCostCenterDataService service, final ErpConfigContext configContext ) { super( HystrixUtil .getDefaultErpCommandSetter( GetCostCentersCommand.class, HystrixUtil.getDefaultErpCommandProperties().withExecutionTimeoutInMilliseconds(5000)) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(20)), configContext); this.service = service; }
Example #19
Source File: HystrixCommandConfigurationTest.java From astrix with Apache License 2.0 | 5 votes |
@Test public void defaultBeanSettingsFromBeanConfiguration() throws Throwable { astrixContext.getBean(Ping.class).ping("foo"); HystrixFaultToleranceFactory hystrixFaultTolerance = getFaultTolerance(astrixContext); HystrixCommandProperties pingCommandProperties = getHystrixCommandProperties(hystrixFaultTolerance, Ping.class); HystrixThreadPoolProperties pingThreadPoolProperties = getThreadPoolProperties(hystrixFaultTolerance, Ping.class); assertEquals(DefaultBeanSettings.DEFAULT_CORE_SIZE, pingThreadPoolProperties.coreSize().get().intValue()); assertEquals(DefaultBeanSettings.DEFAULT_QUEUE_SIZE_REJECTION_THRESHOLD, pingThreadPoolProperties.queueSizeRejectionThreshold().get().intValue()); assertEquals(DefaultBeanSettings.DEFAULT_TIMEOUT, pingCommandProperties.executionTimeoutInMilliseconds().get().intValue()); assertEquals(DefaultBeanSettings.DEFAULT_MAX_CONCURRENT_REQUESTS, pingCommandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get().intValue()); }
Example #20
Source File: GetOrderCommand.java From blog with BSD 2-Clause "Simplified" License | 5 votes |
public GetOrderCommand(String name) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ThreadPoolTestGroup")) .andCommandKey(HystrixCommandKey.Factory.asKey("testCommandKey")) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(name)) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(20000)) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withMaxQueueSize(5) // 配置队列大小 .withCoreSize(2) // 配置线程池里的线程数 )); }
Example #21
Source File: HelloCommand.java From blog with BSD 2-Clause "Simplified" License | 5 votes |
public HelloCommand(String name) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ThreadPoolTestGroup")) .andCommandKey(HystrixCommandKey.Factory.asKey("testCommandKey")) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(name)) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(20000)) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withMaxQueueSize(5) // 配置队列大小 .withCoreSize(2) // 配置线程池里的线程数 )); }
Example #22
Source File: HystrixCommandConfigurationTest.java From astrix with Apache License 2.0 | 5 votes |
private static HystrixThreadPoolProperties getThreadPoolProperties(HystrixFaultToleranceFactory hystrixFaultTolerance, Class<?> api) { HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); HystrixCommandGroupKey groupKey = hystrixFaultTolerance.getGroupKey(AstrixBeanKey.create(api)); return hystrixPropertiesStrategy.getThreadPoolProperties(HystrixThreadPoolKey.Factory.asKey(groupKey.name()), HystrixThreadPoolProperties.Setter()); }
Example #23
Source File: HystrixCommandInterceptor.java From micro-service with MIT License | 5 votes |
private HystrixCommand.Setter configHystrixCommand(String className, String methodName) { return HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(className + "Group")) .andCommandKey(HystrixCommandKey.Factory.asKey(className + "." + methodName)) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(className + "ThreadPool")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD)) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(10)); }
Example #24
Source File: HystrixCommandInterceptor.java From micro-service with MIT License | 5 votes |
private HystrixCommand.Setter configHystrixCommand(String className, String methodName) { return HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(className + "Group")) .andCommandKey(HystrixCommandKey.Factory.asKey(className + "." + methodName)) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(className + "ThreadPool")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD)) .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(10)); }
Example #25
Source File: RequestAttributeHystrixConcurrencyStrategy.java From summerframework with Apache License 2.0 | 5 votes |
@Override public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { return existingConcurrencyStrategy != null ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, threadPoolProperties) : super.getThreadPool(threadPoolKey, threadPoolProperties); }
Example #26
Source File: HystrixPrometheusMetricsPublisherThreadPool.java From prometheus-hystrix with Apache License 2.0 | 5 votes |
public HystrixPrometheusMetricsPublisherThreadPool( HystrixMetricsCollector collector, HystrixThreadPoolKey key, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties, boolean exportProperties, HystrixMetricsPublisherThreadPool delegate) { this.metrics = metrics; this.collector = collector; this.properties = properties; this.exportProperties = exportProperties; this.labels = new TreeMap<String, String>(); this.labels.put("pool_name", key.name()); this.delegate = delegate; }
Example #27
Source File: FwHystrixCommondThread.java From fw-spring-cloud with Apache License 2.0 | 5 votes |
protected FwHystrixCommondThread(String name) { super(Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey("myGroup")) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionIsolationStrategy( HystrixCommandProperties.ExecutionIsolationStrategy.THREAD ) ).andThreadPoolPropertiesDefaults( HystrixThreadPoolProperties.Setter() .withCoreSize(3) )); this.name = name; }
Example #28
Source File: HmilyHystrixConcurrencyStrategy.java From hmily with Apache License 2.0 | 4 votes |
@Override public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { return this.delegate.getThreadPool(threadPoolKey, threadPoolProperties); }
Example #29
Source File: BeanConfigurationPropertiesStrategy.java From astrix with Apache License 2.0 | 4 votes |
private Optional<HystrixThreadPoolProperties> createThreadPoolProperties(AstrixBeanKey<?> beanKey, HystrixThreadPoolKey threadPoolKey, com.netflix.hystrix.HystrixThreadPoolProperties.Setter builder) { return Optional.ofNullable(config.getBeanConfiguration(beanKey)) .map(beanConfiguration -> new AstrixThreadPoolProperties(beanConfiguration, threadPoolKey, builder)); }
Example #30
Source File: AbstractContextConcurrencyStrategy.java From onetwo with Apache License 2.0 | 4 votes |
@Override public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { return existingConcurrencyStrategy != null ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, threadPoolProperties) : super.getThreadPool(threadPoolKey, threadPoolProperties); }