@Override public List<HystrixProperty> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.commandProperties()) : Collections.<HystrixProperty>emptyList(); } }, this.<HystrixProperty>nonEmptyList());
@Override public String apply(DefaultProperties input) { return input.defaultFallback(); } }).or(StringUtils.EMPTY);
private static MetaHolder.Builder setDefaultProperties(MetaHolder.Builder builder, Class<?> declaringClass, final ProceedingJoinPoint joinPoint) { Optional<DefaultProperties> defaultPropertiesOpt = AopUtils.getAnnotation(joinPoint, DefaultProperties.class); builder.defaultGroupKey(declaringClass.getSimpleName()); if (defaultPropertiesOpt.isPresent()) { DefaultProperties defaultProperties = defaultPropertiesOpt.get(); builder.defaultProperties(defaultProperties); if (StringUtils.isNotBlank(defaultProperties.groupKey())) { builder.defaultGroupKey(defaultProperties.groupKey()); } if (StringUtils.isNotBlank(defaultProperties.threadPoolKey())) { builder.defaultThreadPoolKey(defaultProperties.threadPoolKey()); } } return builder; }
@Override public List<HystrixException> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.raiseHystrixExceptions()) : Collections.<HystrixException>emptyList(); } }, this.<HystrixException>nonEmptyList());
@Override public List<Class<? extends Throwable>> get() { return hasDefaultProperties() ? ImmutableList.<Class<? extends Throwable>>copyOf(defaultProperties.ignoreExceptions()) : Collections.<Class<? extends Throwable>>emptyList(); } }, this.<Class<? extends Throwable>>nonEmptyList());
@Override public List<HystrixProperty> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.threadPoolProperties()) : Collections.<HystrixProperty>emptyList(); } }, this.<HystrixProperty>nonEmptyList());
@DefaultProperties(defaultFallback = "classDefaultFallback") public static class ServiceWithDefaultCommandFallback { static final String DEFAULT_RESPONSE = "class_def"; @HystrixCommand public String requestString(String str) { throw new RuntimeException(); } @HystrixCommand public String classDefaultFallback() { return DEFAULT_RESPONSE; } @HystrixCommand(defaultFallback = "defaultCommandFallback") Long commandWithDefaultFallback(long l){ throw new RuntimeException(); } @HystrixCommand(fallbackMethod = "defaultCommandFallback") Long defaultCommandFallback(){ return 0L; } }
@Override public List<HystrixException> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.raiseHystrixExceptions()) : Collections.<HystrixException>emptyList(); } }, this.<HystrixException>nonEmptyList());
@Override public List<Class<? extends Throwable>> get() { return hasDefaultProperties() ? ImmutableList.<Class<? extends Throwable>>copyOf(defaultProperties.ignoreExceptions()) : Collections.<Class<? extends Throwable>>emptyList(); } }, this.<Class<? extends Throwable>>nonEmptyList());
@Override public List<HystrixProperty> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.threadPoolProperties()) : Collections.<HystrixProperty>emptyList(); } }, this.<HystrixProperty>nonEmptyList());
@DefaultProperties(defaultFallback = "classDefaultFallback") public static class ServiceWithDefaultFallback { static final String DEFAULT_RESPONSE = "class_def"; @HystrixCommand public String requestString(String str) { throw new RuntimeException(); } public String classDefaultFallback() { return DEFAULT_RESPONSE; } @HystrixCommand(defaultFallback = "defaultCommandFallback") Long commandWithDefaultFallback(long l){ throw new RuntimeException(); } Long defaultCommandFallback(){ return 0L; } @HystrixCommand(fallbackMethod = "specificFallback") Integer commandWithSpecificFallback(String str) { throw new RuntimeException(); } Integer specificFallback(String str) { return 0; } }
private static MetaHolder.Builder setDefaultProperties(MetaHolder.Builder builder, Class<?> declaringClass, final ProceedingJoinPoint joinPoint) { Optional<DefaultProperties> defaultPropertiesOpt = AopUtils.getAnnotation(joinPoint, DefaultProperties.class); builder.defaultGroupKey(declaringClass.getSimpleName()); if (defaultPropertiesOpt.isPresent()) { DefaultProperties defaultProperties = defaultPropertiesOpt.get(); builder.defaultProperties(defaultProperties); if (StringUtils.isNotBlank(defaultProperties.groupKey())) { builder.defaultGroupKey(defaultProperties.groupKey()); } if (StringUtils.isNotBlank(defaultProperties.threadPoolKey())) { builder.defaultThreadPoolKey(defaultProperties.threadPoolKey()); } } return builder; }
private String getClassLevelFallback(Class<?> enclosingClass) { if (enclosingClass.isAnnotationPresent(DefaultProperties.class)) { return enclosingClass.getAnnotation(DefaultProperties.class).defaultFallback(); } return StringUtils.EMPTY; }
@Override public List<HystrixProperty> get() { return hasDefaultProperties() ? ImmutableList.copyOf(defaultProperties.commandProperties()) : Collections.<HystrixProperty>emptyList(); } }, this.<HystrixProperty>nonEmptyList());
@DefaultProperties(ignoreExceptions = BadRequestException.class, raiseHystrixExceptions = {HystrixException.RUNTIME_EXCEPTION}) public static class Service { @HystrixCommand
@Override public String apply(DefaultProperties input) { return input.defaultFallback(); } }).or(StringUtils.EMPTY);
@DefaultProperties(ignoreExceptions = BadRequestException.class) public static class Service { @HystrixCommand
private String getClassLevelFallback(Class<?> enclosingClass) { if (enclosingClass.isAnnotationPresent(DefaultProperties.class)) { return enclosingClass.getAnnotation(DefaultProperties.class).defaultFallback(); } return StringUtils.EMPTY; }
@DefaultProperties(groupKey = "DefaultGroupKey", threadPoolKey = "DefaultThreadPoolKey", commandProperties = { @HystrixProperty(name = EXECUTION_ISOLATION_THREAD_TIMEOUT_IN_MILLISECONDS, value = "456")
@DefaultProperties(groupKey = "DefaultGroupKey", threadPoolKey = "DefaultThreadPoolKey", commandProperties = {