com.netflix.hystrix.strategy.properties.HystrixProperty Java Examples

The following examples show how to use com.netflix.hystrix.strategy.properties.HystrixProperty. 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: ServiceCombConcurrencyStrategy.java    From servicecomb-pack with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
    HystrixProperty<Integer> corePoolSize,
    HystrixProperty<Integer> maximumPoolSize,
    HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
    BlockingQueue<Runnable> workQueue) {
  return existingConcurrencyStrategy != null
      ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize,
      maximumPoolSize, keepAliveTime, unit, workQueue)
      : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
          keepAliveTime, unit, workQueue);
}
 
Example #2
Source File: ThreadLocalProcessHystrixConcurrencyStrategy.java    From Aooms with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
										HystrixProperty<Integer> corePoolSize,
										HystrixProperty<Integer> maximumPoolSize,
										HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
										BlockingQueue<Runnable> workQueue) {
	return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
			keepAliveTime, unit, workQueue);
}
 
Example #3
Source File: RequestAttributeHystrixConcurrencyStrategy.java    From Taroco with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
            keepAliveTime, unit, workQueue);
}
 
Example #4
Source File: SofaTracerHystrixConcurrencyStrategy.java    From sofa-tracer with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
        keepAliveTime, unit, workQueue);
}
 
Example #5
Source File: RequestAttributeHystrixConcurrencyStrategy.java    From summerframework with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixProperty<Integer> corePoolSize,
    HystrixProperty<Integer> maximumPoolSize, HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
    BlockingQueue<Runnable> workQueue) {
    return existingConcurrencyStrategy != null
        ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime,
            unit, workQueue)
        : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #6
Source File: RequestAttributeHystrixConcurrencyStrategy.java    From spring-cloud-yes with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
            keepAliveTime, unit, workQueue);
}
 
Example #7
Source File: FeignHystrixConcurrencyStrategy.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime,
                                        TimeUnit unit, BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime,
            unit, workQueue);
}
 
Example #8
Source File: FeignHystrixConcurrencyStrategy.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime,
                                        TimeUnit unit, BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime,
            unit, workQueue);
}
 
Example #9
Source File: ThreadLocalAwareStrategy.java    From spring-microservices-in-action with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return existingConcurrencyStrategy != null
            ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue)
            : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #10
Source File: ThreadLocalAwareStrategy.java    From spring-microservices-in-action with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return existingConcurrencyStrategy != null
            ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue)
            : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #11
Source File: ThreadLocalAwareStrategy.java    From spring-microservices-in-action with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return existingConcurrencyStrategy != null
            ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue)
            : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #12
Source File: ThreadLocalAwareStrategy.java    From spring-microservices-in-action with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return existingConcurrencyStrategy != null
            ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue)
            : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #13
Source File: BladeHystrixConcurrencyStrategy.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
										HystrixProperty<Integer> corePoolSize,
										HystrixProperty<Integer> maximumPoolSize,
										HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
										BlockingQueue<Runnable> workQueue) {
	return existingConcurrencyStrategy != null
		? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue)
		: super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #14
Source File: ExecutionContextAwareHystrixStrategy.java    From spring-cloud-ribbon-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    return delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #15
Source File: SeataHystrixConcurrencyStrategy.java    From spring-cloud-alibaba with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixProperty<Integer> corePoolSize,
										HystrixProperty<Integer> maximumPoolSize,
										HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
										BlockingQueue<Runnable> workQueue) {
	return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit,
		workQueue);
}
 
Example #16
Source File: ConcurrencyStrategyDispatcher.java    From astrix with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixProperty<Integer> corePoolSize,
		HystrixProperty<Integer> maximumPoolSize, HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
		BlockingQueue<Runnable> workQueue) {
	return hystrixStrategyMapping.getHystrixStrategies(threadPoolKey)
								 .getHystrixConcurrencyStrategy()
								 .getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
 
Example #17
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 5 votes vote down vote up
@Override
public HystrixProperty<Integer> fallbackIsolationSemaphoreMaxConcurrentRequests() {
	/*
	 * Astrix does not use the fallback of HystrixCommand to do any unsafe operations, and
	 * we always want to call the getFallback method to get proper handling of a failed
	 * service invocation in Astrix, see HystrixCommandFacade/HystrixObservableCommandFacade.
	 *
	 */
	return HystrixProperty.Factory.asProperty(Integer.MAX_VALUE);
}
 
Example #18
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 5 votes vote down vote up
@Override
public HystrixProperty<ExecutionIsolationStrategy> executionIsolationStrategy() {
	// Don't allow change isolation strategy at runtime
	if (this.isolationStrategy != null) {
		return HystrixProperty.Factory.asProperty(this.isolationStrategy); 
	}
	return HystrixProperty.Factory.asProperty(ExecutionIsolationStrategy.THREAD);
}
 
Example #19
Source File: BeanFaultToleranceMetrics.java    From astrix with Apache License 2.0 5 votes vote down vote up
@Override
public int getPoolQueueSizeRejectionThreshold() {
	return Optional.ofNullable(HystrixThreadPoolMetrics.getInstance(poolKey))
			.map(HystrixThreadPoolMetrics::getProperties)
			.map(HystrixThreadPoolProperties::queueSizeRejectionThreshold)
			.map(HystrixProperty::<Integer>get)
			.orElse(0);
}
 
Example #20
Source File: HystrixCommandPropertiesExt.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
private HystrixProperty<Integer> getProperty(String propertyPrefix, String command, HystrixCommandKey key,
    String instanceProperty, Integer builderOverrideValue,
    Integer defaultValue) {
  return forInteger()
      .add(propertyPrefix + "." + command + "." + key.name() + "." + instanceProperty, null)
      .add(propertyPrefix + "." + command + "." + serviceKey(key.name()) + "." + instanceProperty,
          null)
      .add(propertyPrefix + "." + command + "." + typeKey(key.name()) + "." + instanceProperty,
          builderOverrideValue == null ? defaultValue : builderOverrideValue)
      .build();
}
 
Example #21
Source File: HystrixCommandPropertiesExt.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
private HystrixProperty<Boolean> getProperty(String propertyPrefix, String command, HystrixCommandKey key,
    String instanceProperty, Boolean builderOverrideValue, Boolean defaultValue) {
  return forBoolean()
      .add(propertyPrefix + "." + command + "." + key.name() + "." + instanceProperty, null)
      .add(propertyPrefix + "." + command + "." + serviceKey(key.name()) + "." + instanceProperty,
          null)
      .add(propertyPrefix + "." + command + "." + typeKey(key.name()) + "." + instanceProperty,
          builderOverrideValue == null ? defaultValue : builderOverrideValue)
      .build();
}
 
Example #22
Source File: MultiConcurrencyStrategyDispatcher.java    From astrix with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
                                        BlockingQueue<Runnable> workQueue) {
    if (MultiConfigId.hasMultiSourceId(threadPoolKey)) {
        return strategies.get(MultiConfigId.readFrom(threadPoolKey))
                         .getThreadPool(MultiConfigId.decode(threadPoolKey), corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
    }
    else {
        return underlying().map(strategy -> strategy.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue))
                           .orElseGet(() -> super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue));
    }
}
 
Example #23
Source File: FeignHystrixConcurrencyStrategy.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
                                        HystrixProperty<Integer> corePoolSize,
                                        HystrixProperty<Integer> maximumPoolSize,
                                        HystrixProperty<Integer> keepAliveTime,
                                        TimeUnit unit, BlockingQueue<Runnable> workQueue) {
    return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime,
            unit, workQueue);
}
 
Example #24
Source File: AbstractContextConcurrencyStrategy.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
		HystrixProperty<Integer> corePoolSize,
		HystrixProperty<Integer> maximumPoolSize,
		HystrixProperty<Integer> keepAliveTime, TimeUnit unit,
		BlockingQueue<Runnable> workQueue) {
	return existingConcurrencyStrategy != null
			? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize,
					maximumPoolSize, keepAliveTime, unit, workQueue)
			: super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
					keepAliveTime, unit, workQueue);
}
 
Example #25
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Integer> executionTimeoutInMilliseconds() {
	return executionTimeoutInMilliseconds;
}
 
Example #26
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Integer> circuitBreakerErrorThresholdPercentage() {
	return circuitBreakerErrorThresholdPercentage;
}
 
Example #27
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Integer> circuitBreakerSleepWindowInMilliseconds() {
	return circuitBreakerSleepWindowInMilliseconds;
}
 
Example #28
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Integer> executionIsolationSemaphoreMaxConcurrentRequests() {
	return executionIsolationSemaphoreMaxConcurrentRequests;
}
 
Example #29
Source File: AstrixThreadPoolProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Integer> coreSize() {
	return coreSize;
}
 
Example #30
Source File: AstrixCommandProperties.java    From astrix with Apache License 2.0 4 votes vote down vote up
@Override
public HystrixProperty<Boolean> executionIsolationThreadInterruptOnTimeout() {
	return executionIsolationThreadInterruptOnTimeout;
}