rename CircuitBreaker* to Hystrix*
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
package org.springframework.platform.netflix.circuitbreaker;
|
||||
|
||||
/**
|
||||
* Created by sgibb on 6/19/14.
|
||||
*/
|
||||
public interface CircuitBreakerConfigurer {
|
||||
}
|
||||
@@ -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));
|
||||
|
||||
@@ -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<CircuitBreakerConfigurer> configurers) {
|
||||
void setConfigurers(Collection<HystrixConfigurer> configurers) {
|
||||
if (CollectionUtils.isEmpty(configurers)) {
|
||||
return;
|
||||
}
|
||||
@@ -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<EnableCircuitBreaker> {
|
||||
public class HystrixConfigurationSelector extends AdviceModeImportSelector<EnableHystrix> {
|
||||
/**
|
||||
* 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:
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.springframework.platform.netflix.hystrix;
|
||||
|
||||
/**
|
||||
* Created by sgibb on 6/19/14.
|
||||
*/
|
||||
public interface HystrixConfigurer {
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user