Browse Source

Merge pull request #71 from spring-cloud/netflix-versions

update versions of netflix libs
pull/6/head
Spencer Gibb 10 years ago
parent
commit
c8c8b6d0f6
  1. 20
      pom.xml
  2. 8
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java
  3. 19
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaServerConfigBean.java
  4. 14
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java
  5. 45
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerContext.java
  6. 13
      spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/SpringAggregatorFactory.java

20
pom.xml

@ -121,6 +121,12 @@ @@ -121,6 +121,12 @@
<groupId>com.netflix.feign</groupId>
<artifactId>feign-ribbon</artifactId>
<version>${feign.version}</version>
<exclusions>
<exclusion>
<groupId>com.netflix.ribbon</groupId>
<artifactId>ribbon-loadbalancer</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--<dependency>
<groupId>com.netflix.feign</groupId>
@ -249,14 +255,14 @@ @@ -249,14 +255,14 @@
</dependencyManagement>
<properties>
<archaius.version>0.6.0</archaius.version>
<eureka.version>1.1.135</eureka.version>
<feign.version>6.1.2</feign.version>
<archaius.version>0.6.3</archaius.version>
<eureka.version>1.1.145</eureka.version>
<feign.version>6.1.3</feign.version>
<hystrix.version>1.4.0-RC5</hystrix.version>
<ribbon.version>2.0-RC9</ribbon.version>
<turbine.version>0.4</turbine.version>
<zuul.version>1.0.24</zuul.version>
<netflix.rxjava.version>0.20.6</netflix.rxjava.version>
<ribbon.version>2.0-RC13</ribbon.version>
<turbine.version>1.0.0</turbine.version>
<zuul.version>1.0.28</zuul.version>
<netflix.rxjava.version>0.20.7</netflix.rxjava.version>
</properties>
</project>

8
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java

@ -55,6 +55,10 @@ public class EurekaClientConfigBean implements EurekaClientConfig { @@ -55,6 +55,10 @@ public class EurekaClientConfigBean implements EurekaClientConfig {
private String proxyHost;
private String proxyUserName;
private String proxyPassword;
private int eurekaServerReadTimeoutSeconds = 8;
private int eurekaServerConnectTimeoutSeconds = 5;
@ -79,8 +83,12 @@ public class EurekaClientConfigBean implements EurekaClientConfig { @@ -79,8 +83,12 @@ public class EurekaClientConfigBean implements EurekaClientConfig {
private int heartbeatExecutorThreadPoolSize = 2;
private int heartbeatExecutorExponentialBackOffBound = 10;
private int cacheRefreshExecutorThreadPoolSize = 2;
private int cacheRefreshExecutorExponentialBackOffBound = 10;
private Map<String,String> serviceUrl = new HashMap<String, String>();
{

19
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaServerConfigBean.java

@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
*/
package org.springframework.cloud.netflix.eureka;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -181,4 +182,22 @@ public class EurekaServerConfigBean implements EurekaServerConfig { @@ -181,4 +182,22 @@ public class EurekaServerConfigBean implements EurekaServerConfig {
return batchReplication;
}
private boolean logIdentityHeaders = true;
@Override
public boolean shouldLogIdentityHeaders() {
return logIdentityHeaders;
}
private boolean rateLimiterEnabled = false;
private boolean rateLimiterThrottleStandardClients = false;
private Set<String> rateLimiterPrivilegedClients = Collections.emptySet();
private int rateLimiterBurstSize = 10;
private int rateLimiterRegistryFetchAverageRate = 500;
private int rateLimiterFullFetchAverageRate = 100;
}

14
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java

@ -24,7 +24,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { @@ -24,7 +24,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
private SpringClientFactory clientFactory;
private Map<String, ILoadBalancer> balancers = new HashMap<>();
private Map<String, LoadBalancerContext> contexts = new HashMap<>();
private Map<String, RibbonLoadBalancerContext> contexts = new HashMap<>();
public RibbonLoadBalancerClient(RibbonClientPreprocessor ribbonClientPreprocessor, SpringClientFactory clientFactory, List<BaseLoadBalancer> balancers) {
this.ribbonClientPreprocessor = ribbonClientPreprocessor;
@ -37,7 +37,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { @@ -37,7 +37,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
@Override
public URI reconstructURI(ServiceInstance instance, URI original) {
String serviceId = instance.getServiceId();
LoadBalancerContext context = getOrCreateLoadBalancerContext(serviceId, getLoadBalancer(serviceId));
RibbonLoadBalancerContext context = getOrCreateLoadBalancerContext(serviceId, getLoadBalancer(serviceId));
Server server = new Server(instance.getHost(), instance.getPort());
return context.reconstructURIWithServer(server, original);
}
@ -50,7 +50,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { @@ -50,7 +50,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
@Override
public <T> T execute(String serviceId, LoadBalancerRequest<T> request) {
ILoadBalancer loadBalancer = getLoadBalancer(serviceId);
LoadBalancerContext context = getOrCreateLoadBalancerContext(serviceId, loadBalancer);
RibbonLoadBalancerContext context = getOrCreateLoadBalancerContext(serviceId, loadBalancer);
Server server = getServer(serviceId, loadBalancer);
RibbonServer ribbonServer = new RibbonServer(serviceId, server);
@ -70,16 +70,16 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { @@ -70,16 +70,16 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
return null;
}
private void recordStats(LoadBalancerContext context, Stopwatch tracer, ServerStats serverStats, Object entity, Throwable exception) {
private void recordStats(RibbonLoadBalancerContext context, Stopwatch tracer, ServerStats serverStats, Object entity, Throwable exception) {
tracer.stop();
long duration = tracer.getDuration(TimeUnit.MILLISECONDS);
context.noteRequestCompletion(serverStats, entity, exception, duration, null/*errorHandler*/);
}
protected LoadBalancerContext getOrCreateLoadBalancerContext(String serviceId, ILoadBalancer loadBalancer) {
LoadBalancerContext context = contexts.get(serviceId);
protected RibbonLoadBalancerContext getOrCreateLoadBalancerContext(String serviceId, ILoadBalancer loadBalancer) {
RibbonLoadBalancerContext context = contexts.get(serviceId);
if (context == null) {
context = new LoadBalancerContext(loadBalancer);
context = new RibbonLoadBalancerContext(loadBalancer);
contexts.put(serviceId, context);
}
return context;

45
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerContext.java

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
package org.springframework.cloud.netflix.ribbon;
import com.netflix.client.RetryHandler;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.loadbalancer.LoadBalancerContext;
import com.netflix.loadbalancer.ServerStats;
import com.netflix.servo.monitor.Timer;
/**
* @author Spencer Gibb
*/
public class RibbonLoadBalancerContext extends LoadBalancerContext {
public RibbonLoadBalancerContext(ILoadBalancer lb) {
super(lb);
}
public RibbonLoadBalancerContext(ILoadBalancer lb, IClientConfig clientConfig) {
super(lb, clientConfig);
}
public RibbonLoadBalancerContext(ILoadBalancer lb, IClientConfig clientConfig, RetryHandler handler) {
super(lb, clientConfig, handler);
}
@Override
public void noteOpenConnection(ServerStats serverStats) {
super.noteOpenConnection(serverStats);
}
@Override
public Timer getExecuteTracer() {
return super.getExecuteTracer();
}
@Override
public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime) {
super.noteRequestCompletion(stats, response, e, responseTime);
}
@Override
public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime, RetryHandler errorHandler) {
super.noteRequestCompletion(stats, response, e, responseTime, errorHandler);
}
}

13
spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/SpringAggregatorFactory.java

@ -79,6 +79,19 @@ public class SpringAggregatorFactory implements ClusterMonitorFactory<AggDataFro @@ -79,6 +79,19 @@ public class SpringAggregatorFactory implements ClusterMonitorFactory<AggDataFro
return clusters;
}
/**
* shutdown all configured cluster monitors
*/
@Override
public void shutdownClusterMonitors() {
for(String clusterName : getClusterNames()) {
ClusterMonitor<AggDataFromCluster> clusterMonitor = (ClusterMonitor<AggDataFromCluster>) AggregateClusterMonitor.findOrRegisterAggregateMonitor(clusterName);
clusterMonitor.stopMonitor();
clusterMonitor.getDispatcher().stopDispatcher();
}
}
private TurbineDataHandler<AggDataFromCluster> StaticListener = new TurbineDataHandler<AggDataFromCluster>() {
@Override

Loading…
Cancel
Save