@Override public String getValue() { return properties.executionIsolationStrategy().get().name(); } });
/** * Get the TryableSemaphore this HystrixCommand should use for execution if not running in a separate thread. * * @return TryableSemaphore */ protected TryableSemaphore getExecutionSemaphore() { if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.SEMAPHORE) { if (executionSemaphoreOverride == null) { TryableSemaphore _s = executionSemaphorePerCircuit.get(commandKey.name()); if (_s == null) { // we didn't find one cache so setup executionSemaphorePerCircuit.putIfAbsent(commandKey.name(), new TryableSemaphoreActual(properties.executionIsolationSemaphoreMaxConcurrentRequests())); // assign whatever got set (this or another thread) return executionSemaphorePerCircuit.get(commandKey.name()); } else { return _s; } } else { return executionSemaphoreOverride; } } else { // return NoOp implementation since we're not using SEMAPHORE isolation return TryableSemaphoreNoOp.DEFAULT; } }
@Override public void call() { if (!commandIsScalar()) { long latency = System.currentTimeMillis() - executionResult.getStartTimestamp(); eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey); executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS); eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList()); circuitBreaker.markSuccess(); } } };
private Observable<R> executeCommandWithSpecifiedIsolation(final AbstractCommand<R> _cmd) { if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.THREAD) {
public boolean isCommandRunningInThread() { return super.getProperties().executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.THREAD); }
public boolean isCommandRunningInThread() { return super.getProperties().executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.THREAD); }
public boolean isCommandRunningInThread() { return super.getProperties().executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.THREAD); }
public boolean isCommandRunningInThread() { return super.getProperties().executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.THREAD); }
@Override public void call(R r) { if (shouldOutputOnNextEvents()) { executionResult = executionResult.addEvent(HystrixEventType.EMIT); eventNotifier.markEvent(HystrixEventType.EMIT, commandKey); } if (commandIsScalar()) { long latency = System.currentTimeMillis() - executionResult.getStartTimestamp(); eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey); executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS); eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList()); circuitBreaker.markSuccess(); } } };
assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS)); assertEquals(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE, command.getProperties().executionIsolationStrategy().get()); assertEquals(500, command.getProperties().executionTimeoutInMilliseconds().get().intValue()); assertEquals(true, command.getProperties().executionTimeoutEnabled().get().booleanValue());
HystrixCommandExecutionConfig executionConfig = new HystrixCommandExecutionConfig( commandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get(), commandProperties.executionIsolationStrategy().get(), commandProperties.executionIsolationThreadInterruptOnTimeout().get(), commandProperties.executionIsolationThreadPoolKeyOverride().get(),
@Override public String getValue() { return properties.executionIsolationStrategy().get().name(); } });
@Override public String getValue() { return properties.executionIsolationStrategy().get().name(); } });
@Override public Number call() { return properties.executionIsolationStrategy().get().ordinal(); } });
@Override public String value() { return properties.executionIsolationStrategy().get().name(); } });
/** * Get the TryableSemaphore this HystrixCommand should use for execution if not running in a separate thread. * * @return TryableSemaphore */ protected TryableSemaphore getExecutionSemaphore() { if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.SEMAPHORE) { if (executionSemaphoreOverride == null) { TryableSemaphore _s = executionSemaphorePerCircuit.get(commandKey.name()); if (_s == null) { // we didn't find one cache so setup executionSemaphorePerCircuit.putIfAbsent(commandKey.name(), new TryableSemaphoreActual(properties.executionIsolationSemaphoreMaxConcurrentRequests())); // assign whatever got set (this or another thread) return executionSemaphorePerCircuit.get(commandKey.name()); } else { return _s; } } else { return executionSemaphoreOverride; } } else { // return NoOp implementation since we're not using SEMAPHORE isolation return TryableSemaphoreNoOp.DEFAULT; } }
@Override public void call() { if (!commandIsScalar()) { long latency = System.currentTimeMillis() - executionResult.getStartTimestamp(); eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList()); eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey); executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS); circuitBreaker.markSuccess(); } } };
@Override public void call(R r) { if (shouldOutputOnNextEvents()) { executionResult = executionResult.addEvent(HystrixEventType.EMIT); eventNotifier.markEvent(HystrixEventType.EMIT, commandKey); } if (commandIsScalar()) { long latency = System.currentTimeMillis() - executionResult.getStartTimestamp(); eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList()); eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey); executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS); circuitBreaker.markSuccess(); } } };
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()); } }
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()); } }