Browse Source

Merge pull request #89 from allenxwang/5.x

Update to Ribbon 0.3.1
5.x
Adrian Cole 11 years ago
parent
commit
7b40f422ff
  1. 2
      build.gradle
  2. 15
      ribbon/src/main/java/feign/ribbon/LBClient.java

2
build.gradle

@ -113,7 +113,7 @@ project(':feign-ribbon') { @@ -113,7 +113,7 @@ project(':feign-ribbon') {
dependencies {
compile project(':feign-core')
compile 'com.netflix.ribbon:ribbon-core:0.2.3'
compile 'com.netflix.ribbon:ribbon-core:0.3.1'
testCompile 'org.testng:testng:6.8.5'
testCompile 'com.google.mockwebserver:mockwebserver:20130706'
}

15
ribbon/src/main/java/feign/ribbon/LBClient.java

@ -62,11 +62,11 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L @@ -62,11 +62,11 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L
return new RibbonResponse(request.getUri(), response);
}
@Override protected boolean isCircuitBreakerException(Exception e) {
@Override protected boolean isCircuitBreakerException(Throwable e) {
return e instanceof IOException;
}
@Override protected boolean isRetriableException(Exception e) {
@Override protected boolean isRetriableException(Throwable e) {
return e instanceof RetryableException;
}
@ -75,10 +75,6 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L @@ -75,10 +75,6 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L
return new Pair<String, Integer>(URI.create(task.request.url()).getScheme(), task.getUri().getPort());
}
@Override protected int getDefaultPort() {
return 443;
}
static class RibbonRequest extends ClientRequest implements Cloneable {
private final Request request;
@ -134,6 +130,13 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L @@ -134,6 +130,13 @@ class LBClient extends AbstractLoadBalancerAwareClient<LBClient.RibbonRequest, L
Response toResponse() {
return response;
}
@Override
public void close() throws IOException {
if (response.body() != null) {
response.body().close();
}
}
}
static int config(RibbonRequest request, CommonClientConfigKey key, int defaultValue) {

Loading…
Cancel
Save