From 10d1ed38dc120b53121f998230f44ebca0ac8760 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 29 Jul 2014 13:55:08 -0600 Subject: [PATCH] rename CircuitBreaker* to Hystrix* --- .../CircuitBreakerConfigurer.java | 7 ------- .../eureka/EurekaServerAutoConfiguration.java | 2 +- .../HystrixConfiguration.java} | 18 +++++++++--------- .../HystrixConfigurationSelector.java} | 10 +++++----- .../netflix/hystrix/HystrixConfigurer.java | 7 +++++++ .../annotations/EnableHystrix.java} | 10 ++++------ .../src/main/resources/application.yml | 6 +++--- 7 files changed, 29 insertions(+), 31 deletions(-) delete mode 100644 spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurer.java rename spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/{circuitbreaker/CircuitBreakerConfiguration.java => hystrix/HystrixConfiguration.java} (69%) rename spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/{circuitbreaker/CircuitBreakerConfigurationSelector.java => hystrix/HystrixConfigurationSelector.java} (67%) create mode 100644 spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurer.java rename spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/{circuitbreaker/annotations/EnableCircuitBreaker.java => hystrix/annotations/EnableHystrix.java} (86%) diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurer.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurer.java deleted file mode 100644 index 602292a6..00000000 --- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurer.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.springframework.platform.netflix.circuitbreaker; - -/** - * Created by sgibb on 6/19/14. - */ -public interface CircuitBreakerConfigurer { -} diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java index d6abaf70..3ffda400 100644 --- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java +++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java @@ -73,7 +73,7 @@ public class EurekaServerAutoConfiguration implements ServletContextAware, LoggingConfiguration.getInstance().configure(); EurekaServerConfigurationManager.getInstance() .setConfiguration(eurekaServerConfig); - PeerAwareInstanceRegistry.getInstance(); + //PeerAwareInstanceRegistry.getInstance(); applicationContext.publishEvent(new EurekaRegistryAvailableEvent(eurekaServerConfig)); } }.contextInitialized(new ServletContextEvent(servletContext)); diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfiguration.java similarity index 69% rename from spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java rename to spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfiguration.java index 618f3de8..6a5a734d 100644 --- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java +++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfiguration.java @@ -1,4 +1,4 @@ -package org.springframework.platform.netflix.circuitbreaker; +package org.springframework.platform.netflix.hystrix; import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect; import org.springframework.beans.factory.annotation.Autowired; @@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportAware; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.type.AnnotationMetadata; -import org.springframework.platform.netflix.circuitbreaker.annotations.EnableCircuitBreaker; +import org.springframework.platform.netflix.hystrix.annotations.EnableHystrix; import org.springframework.platform.netflix.endpoint.HystrixStreamEndpoint; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -18,9 +18,9 @@ import java.util.Collection; * Created by sgibb on 6/19/14. */ @Configuration -public class CircuitBreakerConfiguration implements ImportAware { +public class HystrixConfiguration implements ImportAware { - private AnnotationAttributes enableCircuitBreaker; + private AnnotationAttributes enableHystrix; @Bean HystrixCommandAspect hystrixCommandAspect() { @@ -35,14 +35,14 @@ public class CircuitBreakerConfiguration implements ImportAware { @Override public void setImportMetadata(AnnotationMetadata importMetadata) { - this.enableCircuitBreaker = AnnotationAttributes.fromMap( - importMetadata.getAnnotationAttributes(EnableCircuitBreaker.class.getName(), false)); - Assert.notNull(this.enableCircuitBreaker, - "@EnableCircuitBreaker is not present on importing class " + importMetadata.getClassName()); + this.enableHystrix = AnnotationAttributes.fromMap( + importMetadata.getAnnotationAttributes(EnableHystrix.class.getName(), false)); + Assert.notNull(this.enableHystrix, + "@EnableHystrix is not present on importing class " + importMetadata.getClassName()); } @Autowired(required=false) - void setConfigurers(Collection configurers) { + void setConfigurers(Collection configurers) { if (CollectionUtils.isEmpty(configurers)) { return; } diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurationSelector.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurationSelector.java similarity index 67% rename from spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurationSelector.java rename to spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurationSelector.java index 6de08edd..8c7f28db 100644 --- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfigurationSelector.java +++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurationSelector.java @@ -1,25 +1,25 @@ -package org.springframework.platform.netflix.circuitbreaker; +package org.springframework.platform.netflix.hystrix; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.AdviceModeImportSelector; import org.springframework.context.annotation.AutoProxyRegistrar; -import org.springframework.platform.netflix.circuitbreaker.annotations.EnableCircuitBreaker; +import org.springframework.platform.netflix.hystrix.annotations.EnableHystrix; /** * Created by sgibb on 6/19/14. */ -public class CircuitBreakerConfigurationSelector extends AdviceModeImportSelector { +public class HystrixConfigurationSelector extends AdviceModeImportSelector { /** * The name of the AspectJ transaction management @{@code Configuration} class. */ - public static final String TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME = + private static final String TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME = "org.springframework.transaction.aspectj.AspectJTransactionManagementConfiguration"; @Override protected String[] selectImports(AdviceMode adviceMode) { switch (adviceMode) { case PROXY: - return new String[]{AutoProxyRegistrar.class.getName(), CircuitBreakerConfiguration.class.getName()}; + return new String[]{AutoProxyRegistrar.class.getName(), HystrixConfiguration.class.getName()}; case ASPECTJ: return new String[]{TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME}; default: diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurer.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurer.java new file mode 100644 index 00000000..0d88838d --- /dev/null +++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/HystrixConfigurer.java @@ -0,0 +1,7 @@ +package org.springframework.platform.netflix.hystrix; + +/** + * Created by sgibb on 6/19/14. + */ +public interface HystrixConfigurer { +} diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/annotations/EnableCircuitBreaker.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/annotations/EnableHystrix.java similarity index 86% rename from spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/annotations/EnableCircuitBreaker.java rename to spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/annotations/EnableHystrix.java index 1e40b50a..af13a4a0 100644 --- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/annotations/EnableCircuitBreaker.java +++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/hystrix/annotations/EnableHystrix.java @@ -1,9 +1,9 @@ -package org.springframework.platform.netflix.circuitbreaker.annotations; +package org.springframework.platform.netflix.hystrix.annotations; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.Import; import org.springframework.core.Ordered; -import org.springframework.platform.netflix.circuitbreaker.CircuitBreakerConfigurationSelector; +import org.springframework.platform.netflix.hystrix.HystrixConfigurationSelector; import java.lang.annotation.*; @@ -13,9 +13,8 @@ import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented -@Import(CircuitBreakerConfigurationSelector.class) -public @interface EnableCircuitBreaker { - +@Import(HystrixConfigurationSelector.class) +public @interface EnableHystrix { /** * Indicate whether subclass-based (CGLIB) proxies are to be created ({@code true}) as * opposed to standard Java interface-based proxies ({@code false}). The default is @@ -43,5 +42,4 @@ public @interface EnableCircuitBreaker { * The default is {@link org.springframework.core.Ordered#LOWEST_PRECEDENCE}. */ int order() default Ordered.LOWEST_PRECEDENCE; - } \ No newline at end of file diff --git a/spring-platform-netflix-zuul/src/main/resources/application.yml b/spring-platform-netflix-zuul/src/main/resources/application.yml index 6d70b42c..014037ef 100644 --- a/spring-platform-netflix-zuul/src/main/resources/application.yml +++ b/spring-platform-netflix-zuul/src/main/resources/application.yml @@ -39,9 +39,9 @@ eureka: us-east-1: availabilityZones: default - serviceUrl: - default: http://localhost:8080/eureka/v2/ - defaultZone: http://localhost:8080/eureka/v2/ + #serviceUrl: + #default: http://localhost:8080/eureka/v2/ + #defaultZone: http://localhost:8080/eureka/v2/ instance: #Virtual host name by which the clients identifies this service