com.netflix.hystrix.HystrixCommand.Setter Java Examples
The following examples show how to use
com.netflix.hystrix.HystrixCommand.Setter.
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: HystrixCommandInterceptor.java From micro-service with MIT License | 6 votes |
private HystrixCommand<Object> wrapHystrixCommand(final ProceedingJoinPoint point) { String className = point.getTarget().getClass().getSimpleName(); String methodName = point.getSignature().getName(); Setter setter = configHystrixCommand(className, methodName); return new HystrixCommand<Object>(setter) { @Override protected Object run() throws Exception { try { return point.proceed(); } catch (Throwable throwable) { throw (Exception) throwable; } } @Override protected Object getFallback() { return null; } }; }
Example #2
Source File: HystrixCommandInterceptor.java From micro-service with MIT License | 6 votes |
private HystrixCommand<Object> wrapHystrixCommand(final ProceedingJoinPoint point) { String className = point.getTarget().getClass().getSimpleName(); String methodName = point.getSignature().getName(); Setter setter = configHystrixCommand(className, methodName); return new HystrixCommand<Object>(setter) { @Override protected Object run() throws Exception { try { return point.proceed(); } catch (Throwable throwable) { logger.error("micro service throw exception, {}", throwable.getMessage()); throw (Exception) throwable; } } @Override protected Object getFallback() { logger.warn("micro service does not work normally..."); return null; } }; }
Example #3
Source File: EnhanceInvocationHandler.java From onetwo with Apache License 2.0 | 5 votes |
/** * Process all methods in the target so that appropriate setters are created. */ static Map<Method, Setter> toSetters(SetterFactory setterFactory, Target<?> target, Set<Method> methods) { Map<Method, Setter> result = new LinkedHashMap<Method, Setter>(); for (Method method : methods) { method.setAccessible(true); result.put(method, setterFactory.create(target, method)); } return result; }
Example #4
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 #5
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 #6
Source File: HystrixInvocationHandler.java From feign with Apache License 2.0 | 5 votes |
/** * Process all methods in the target so that appropriate setters are created. */ static Map<Method, Setter> toSetters(SetterFactory setterFactory, Target<?> target, Set<Method> methods) { Map<Method, Setter> result = new LinkedHashMap<Method, Setter>(); for (Method method : methods) { method.setAccessible(true); result.put(method, setterFactory.create(target, method)); } return result; }
Example #7
Source File: HystrixCommandFacade.java From astrix with Apache License 2.0 | 4 votes |
private HystrixCommandFacade(CheckedCommand<T> command, Setter hystrixConfiguration, ContextPropagation contextPropagation) { this.command = command; this.hystrixConfiguration = hystrixConfiguration; this.contextPropagation = Objects.requireNonNull(contextPropagation); }
Example #8
Source File: HystrixCommandFacade.java From astrix with Apache License 2.0 | 4 votes |
/** * @deprecated please use {@link #execute(CheckedCommand, Setter, ContextPropagation)} */ @Deprecated public static <T> T execute(CheckedCommand<T> command, Setter settings) throws Throwable { return execute(command, settings, ContextPropagation.NONE); }
Example #9
Source File: HystrixCommandFacade.java From astrix with Apache License 2.0 | 4 votes |
public static <T> T execute(CheckedCommand<T> command, Setter settings, ContextPropagation contextPropagation) throws Throwable { return new HystrixCommandFacade<>(command, settings, contextPropagation).execute(); }