com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy Java Examples
The following examples show how to use
com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy.
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: MultiEventNotifierDispatcher.java From astrix with Apache License 2.0 | 6 votes |
@Override public void markCommandExecution(HystrixCommandKey key, ExecutionIsolationStrategy isolationStrategy, int duration, List<HystrixEventType> eventsDuringExecution) { if (MultiConfigId.hasMultiSourceId(key)) { strategies.get(MultiConfigId.readFrom(key)) .markCommandExecution(MultiConfigId.decode(key), isolationStrategy, duration, eventsDuringExecution); } else { underlying() .map(notifier -> { notifier.markCommandExecution(key, isolationStrategy, duration, eventsDuringExecution); return null; }) .orElseGet(() -> { super.markCommandExecution(key, isolationStrategy, duration, eventsDuringExecution); return null; }); } }
Example #2
Source File: CommandUsingSemaphoreIsolation.java From tools-journey with Apache License 2.0 | 5 votes |
public CommandUsingSemaphoreIsolation(int id) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")) // since we're doing work in the run() method that doesn't involve network traffic // and executes very fast with low risk we choose SEMAPHORE isolation .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE))); this.id = id; }
Example #3
Source File: HookExecutor.java From flux with Apache License 2.0 | 5 votes |
/** * Constructor for this class * @param hook the Hook to execute */ public HookExecutor(AbstractHook hook, EventData[] events) { super(Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(hook.getHookGroupName())) .andCommandKey(HystrixCommandKey.Factory.asKey(hook.getName())) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(hook.getName() + "-TP")) // creating a new thread pool per hook by appending "-TP" to the hook name .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(hook.getExecutionConcurrency())) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) .withExecutionTimeoutInMilliseconds(hook.getExecutionTimeout()))); this.hook = hook; }
Example #4
Source File: TaskExecutor.java From flux with Apache License 2.0 | 5 votes |
/** * Constructor for this class */ public TaskExecutor(AbstractTask task, EventData[] events, String stateMachineId, String outputEventName) { super(Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(task.getTaskGroupName())) .andCommandKey(HystrixCommandKey.Factory.asKey(task.getName())) .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(task.getName() + "-TP")) // creating a new thread pool per task by appending "-TP" to the task name .andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(task.getExecutionConcurrency())) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) .withExecutionTimeoutInMilliseconds(task.getExecutionTimeout()))); this.task = task; this.events = events; this.stateMachineId = stateMachineId; this.outputEventName = outputEventName; }
Example #5
Source File: EventNotifierDispatcher.java From astrix with Apache License 2.0 | 5 votes |
@Override public void markCommandExecution(HystrixCommandKey key, ExecutionIsolationStrategy isolationStrategy, int duration, List<HystrixEventType> eventsDuringExecution) { strategymapping.getHystrixStrategies(key) .getHystrixEventNotifier() .markCommandExecution(key, isolationStrategy, duration, eventsDuringExecution); }
Example #6
Source File: HystrixBeanFaultTolerance.java From astrix with Apache License 2.0 | 5 votes |
public HystrixBeanFaultTolerance(HystrixCommandKey commandKey, HystrixCommandGroupKey groupKey, ContextPropagation contextPropagation) { observableSettings = Setter.withGroupKey(groupKey) .andCommandKey(commandKey) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE)); commandSettings = com.netflix.hystrix.HystrixCommand.Setter.withGroupKey(groupKey) .andCommandKey(commandKey) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD)); this.contextPropagators = Objects.requireNonNull(contextPropagation); }
Example #7
Source File: TestBCommand.java From skywalking with Apache License 2.0 | 5 votes |
protected TestBCommand(String name) { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestBCommand")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionTimeoutInMilliseconds(1000)) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE))); this.name = name; }