Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
3a066323
Commit
3a066323
authored
Dec 02, 2014
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added @EnableCircuitBreaker deprecated @EnableHystrix.
removed classes now in spring-cloud-commons
parent
61ea7843
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
80 additions
and
210 deletions
+80
-210
pom.xml
pom.xml
+5
-0
pom.xml
spring-cloud-netflix-core/pom.xml
+5
-0
ServiceInstance.java
...ava/org/springframework/cloud/client/ServiceInstance.java
+0
-12
DiscoveryClient.java
...ringframework/cloud/client/discovery/DiscoveryClient.java
+0
-19
EnableDiscoveryClient.java
...amework/cloud/client/discovery/EnableDiscoveryClient.java
+0
-17
EnableDiscoveryClientImportSelector.java
...client/discovery/EnableDiscoveryClientImportSelector.java
+0
-59
InstanceRegisteredEvent.java
...ework/cloud/client/discovery/InstanceRegisteredEvent.java
+0
-24
LoadBalancerClient.java
...amework/cloud/client/loadbalancer/LoadBalancerClient.java
+0
-27
LoadBalancerRequest.java
...mework/cloud/client/loadbalancer/LoadBalancerRequest.java
+0
-10
EurekaDiscoveryClient.java
...framework/cloud/netflix/eureka/EurekaDiscoveryClient.java
+20
-0
EnableHystrix.java
.../springframework/cloud/netflix/hystrix/EnableHystrix.java
+2
-0
HystrixConfiguration.java
...framework/cloud/netflix/hystrix/HystrixConfiguration.java
+11
-28
EnableZuulProxy.java
...g/springframework/cloud/netflix/zuul/EnableZuulProxy.java
+9
-6
EnableZuulServer.java
.../springframework/cloud/netflix/zuul/EnableZuulServer.java
+4
-4
spring.factories
...netflix-core/src/main/resources/META-INF/spring.factories
+4
-0
pom.xml
spring-cloud-netflix-eureka-server/pom.xml
+4
-0
pom.xml
spring-cloud-netflix-hystrix-dashboard/pom.xml
+4
-0
pom.xml
spring-cloud-netflix-sidecar/pom.xml
+4
-0
EnableSidecar.java
.../springframework/cloud/netflix/sidecar/EnableSidecar.java
+4
-4
pom.xml
spring-cloud-netflix-turbine/pom.xml
+4
-0
No files found.
pom.xml
View file @
3a066323
...
...
@@ -38,6 +38,11 @@
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
<version>
1.0.0.BUILD-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-client
</artifactId>
<version>
1.0.0.BUILD-SNAPSHOT
</version>
</dependency>
...
...
spring-cloud-netflix-core/pom.xml
View file @
3a066323
...
...
@@ -26,6 +26,11 @@
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-client
</artifactId>
<optional>
true
</optional>
</dependency>
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/ServiceInstance.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
;
/**
* @author Spencer Gibb
* TODO: name? Server? HostAndPort? Instance?
*/
public
interface
ServiceInstance
{
public
String
getServiceId
();
public
String
getHost
();
public
int
getPort
();
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
discovery
;
import
org.springframework.cloud.client.ServiceInstance
;
import
java.util.List
;
/**
* @author Spencer Gibb
*/
public
interface
DiscoveryClient
{
/**
* @return ServiceInstance with information used to register the local service
*/
public
ServiceInstance
getLocalServiceInstance
();
public
List
<
ServiceInstance
>
getInstances
(
String
serviceId
);
public
List
<
String
>
getServices
();
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClient.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
discovery
;
/**
* @author Spencer Gibb
*/
import
org.springframework.context.annotation.Import
;
import
java.lang.annotation.*
;
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Inherited
@Import
(
EnableDiscoveryClientImportSelector
.
class
)
public
@interface
EnableDiscoveryClient
{
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
discovery
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.BeanClassLoaderAware
;
import
org.springframework.context.annotation.DeferredImportSelector
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.AnnotationAttributes
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.io.support.SpringFactoriesLoader
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.util.Assert
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
/**
* @author Spencer Gibb
*/
@Order
(
Ordered
.
LOWEST_PRECEDENCE
-
100
)
@Slf4j
public
class
EnableDiscoveryClientImportSelector
implements
DeferredImportSelector
,
BeanClassLoaderAware
{
private
ClassLoader
beanClassLoader
;
@Override
public
String
[]
selectImports
(
AnnotationMetadata
metadata
)
{
AnnotationAttributes
attributes
=
AnnotationAttributes
.
fromMap
(
metadata
.
getAnnotationAttributes
(
EnableDiscoveryClient
.
class
.
getName
(),
true
));
Assert
.
notNull
(
attributes
,
"No EnableDiscoveryClient attributes found. Is "
+
metadata
.
getClassName
()
+
" annotated with @EnableDiscoveryClient?"
);
// Find all possible auto configuration classes, filtering duplicates
List
<
String
>
factories
=
new
ArrayList
<>(
new
LinkedHashSet
<>(
SpringFactoriesLoader
.
loadFactoryNames
(
EnableDiscoveryClient
.
class
,
this
.
beanClassLoader
)));
if
(
factories
.
size
()
>
1
)
{
String
factory
=
factories
.
get
(
0
);
//there should only every be one DiscoveryClient
log
.
warn
(
"More than one implementation of @EnableDiscoveryClient. Using {} out of available {}"
,
factory
,
factories
);
factories
=
Collections
.
singletonList
(
factory
);
}
return
factories
.
toArray
(
new
String
[
factories
.
size
()]);
}
@Override
public
void
setBeanClassLoader
(
ClassLoader
classLoader
)
{
this
.
beanClassLoader
=
classLoader
;
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/discovery/InstanceRegisteredEvent.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
discovery
;
import
org.springframework.context.ApplicationEvent
;
/**
* @author Spencer Gibb
*/
public
class
InstanceRegisteredEvent
extends
ApplicationEvent
{
private
Object
config
;
/**
* Create a new ApplicationEvent.
*
* @param source the component that published the event (never {@code null})
*/
public
InstanceRegisteredEvent
(
Object
source
,
Object
config
)
{
super
(
source
);
this
.
config
=
config
;
}
public
Object
getConfig
()
{
return
config
;
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
loadbalancer
;
import
org.springframework.cloud.client.ServiceInstance
;
import
java.net.URI
;
/**
* @author Spencer Gibb
*/
public
interface
LoadBalancerClient
{
/**
* Choose a {@see ServiceInstance} from the LoadBalancer for the specified service
* @param serviceId the service id to look up the LoadBalancer
* @return a ServiceInstance that matches the serviceId
*/
public
ServiceInstance
choose
(
String
serviceId
);
/**
* Choose a {@see ServiceInstance} from the LoadBalancer for the specified service
* @param serviceId the service id to look up the LoadBalancer
* @param request allows implementations to execute pre and post actions such as incrementing metrics
* @return the result of the LoadBalancerRequest callback on the selected ServiceInstance
*/
public
<
T
>
T
execute
(
String
serviceId
,
LoadBalancerRequest
<
T
>
request
);
public
URI
reconstructURI
(
ServiceInstance
instance
,
URI
original
);
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java
deleted
100644 → 0
View file @
61ea7843
package
org
.
springframework
.
cloud
.
client
.
loadbalancer
;
import
org.springframework.cloud.client.ServiceInstance
;
/**
* @author Spencer Gibb
*/
public
interface
LoadBalancerRequest
<
T
>
{
public
T
apply
(
ServiceInstance
instance
)
throws
Exception
;
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java
View file @
3a066323
...
...
@@ -96,4 +96,24 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
}
}));
}
@Override
public
List
<
ServiceInstance
>
getAllInstances
()
{
Applications
applications
=
discovery
.
getApplications
();
if
(
applications
==
null
)
{
return
Collections
.
emptyList
();
}
Iterable
<
ServiceInstance
>
instances
=
transform
(
concat
(
transform
(
applications
.
getRegisteredApplications
(),
new
Function
<
Application
,
List
<
InstanceInfo
>>()
{
public
List
<
InstanceInfo
>
apply
(
@Nullable
Application
app
)
{
return
app
.
getInstances
();
}
})),
new
Function
<
InstanceInfo
,
ServiceInstance
>()
{
@Nullable
@Override
public
ServiceInstance
apply
(
@Nullable
InstanceInfo
info
)
{
return
new
EurekaServiceInstance
(
info
);
}
});
return
Lists
.
newArrayList
(
instances
);
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/EnableHystrix.java
View file @
3a066323
...
...
@@ -26,5 +26,6 @@ import java.lang.annotation.*;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Import
(
HystrixConfiguration
.
class
)
@Deprecated
public
@interface
EnableHystrix
{
}
\ No newline at end of file
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConfiguration.java
View file @
3a066323
...
...
@@ -16,12 +16,11 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.netflix.hystrix.Hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.MetricsAsJsonPollerListener
;
import
org.apache.catalina.core.ApplicationContext
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -34,26 +33,20 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
import
org.springframework.context.SmartLifecycle
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.ImportAware
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.AnnotationAttributes
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.util.Assert
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.netflix.hystrix.Hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspec
t
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.MetricsAsJsonPollerListener
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.HashSe
t
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author Spencer Gibb
* @author Christian Dupuis
*/
@Configuration
public
class
HystrixConfiguration
implements
ImportAware
{
private
AnnotationAttributes
enableHystrix
;
public
class
HystrixConfiguration
{
@Bean
public
HystrixCommandAspect
hystrixCommandAspect
()
{
...
...
@@ -77,16 +70,6 @@ public class HystrixConfiguration implements ImportAware {
}
@Override
public
void
setImportMetadata
(
AnnotationMetadata
importMetadata
)
{
this
.
enableHystrix
=
AnnotationAttributes
.
fromMap
(
importMetadata
.
getAnnotationAttributes
(
EnableHystrix
.
class
.
getName
(),
false
));
Assert
.
notNull
(
this
.
enableHystrix
,
"@EnableHystrix is not present on importing class "
+
importMetadata
.
getClassName
());
}
@Configuration
@ConditionalOnClass
(
GaugeService
.
class
)
protected
static
class
HystrixMetricsPollerConfiguration
implements
SmartLifecycle
{
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulProxy.java
View file @
3a066323
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
java.lang.annotation.*
;
import
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.netflix.hystrix.EnableHystrix
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author Spencer Gibb
*/
@Enable
Hystrix
@Enable
Eureka
Client
@Enable
CircuitBreaker
@Enable
Discovery
Client
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Import
(
ZuulConfiguration
.
class
)
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/EnableZuulServer.java
View file @
3a066323
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
org.springframework.cloud.
netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.
netflix.hystrix.EnableHystrix
;
import
org.springframework.cloud.
client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.
client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.Import
;
import
java.lang.annotation.*
;
...
...
@@ -10,8 +10,8 @@ import java.lang.annotation.*;
* @author Spencer Gibb
* @deprecated @see org.springframework.cloud.netflix.zuul.EnableZuulProxy
*/
@Enable
Hystrix
@Enable
Eureka
Client
@Enable
CircuitBreaker
@Enable
Discovery
Client
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
...
...
spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories
View file @
3a066323
...
...
@@ -13,3 +13,6 @@ org.springframework.cloud.netflix.config.DiscoveryClientConfigServiceBootstrapCo
org.springframework.cloud.client.discovery.EnableDiscoveryClient=\
org.springframework.cloud.netflix.eureka.EurekaClientConfiguration
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker=\
org.springframework.cloud.netflix.hystrix.HystrixConfiguration
\ No newline at end of file
spring-cloud-netflix-eureka-server/pom.xml
View file @
3a066323
...
...
@@ -44,6 +44,10 @@
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-netflix-core
</artifactId>
</dependency>
<dependency>
...
...
spring-cloud-netflix-hystrix-dashboard/pom.xml
View file @
3a066323
...
...
@@ -26,6 +26,10 @@
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-netflix-core
</artifactId>
</dependency>
<dependency>
...
...
spring-cloud-netflix-sidecar/pom.xml
View file @
3a066323
...
...
@@ -24,6 +24,10 @@
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-netflix-core
</artifactId>
</dependency>
<dependency>
...
...
spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/EnableSidecar.java
View file @
3a066323
package
org
.
springframework
.
cloud
.
netflix
.
sidecar
;
import
org.springframework.cloud.
netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.
netflix.hystrix.EnableHystrix
;
import
org.springframework.cloud.
client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.
client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.context.annotation.Import
;
...
...
@@ -10,8 +10,8 @@ import java.lang.annotation.*;
/**
* @author Spencer Gibb
*/
@Enable
Hystrix
@Enable
Eureka
Client
@Enable
CircuitBreaker
@Enable
Discovery
Client
@EnableZuulProxy
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
...
...
spring-cloud-netflix-turbine/pom.xml
View file @
3a066323
...
...
@@ -24,6 +24,10 @@
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-netflix-core
</artifactId>
</dependency>
<dependency>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment