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
b9a6876d
Commit
b9a6876d
authored
Mar 16, 2016
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade ribbon to 2.1.3
fixes gh-908
parent
f76675a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
26 deletions
+31
-26
LoadBalancerFeignClient.java
...k/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java
+13
-2
FeignRibbonClientRetryTests.java
...oud/netflix/feign/ribbon/FeignRibbonClientRetryTests.java
+17
-23
pom.xml
spring-cloud-netflix-dependencies/pom.xml
+1
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/LoadBalancerFeignClient.java
View file @
b9a6876d
...
@@ -54,13 +54,24 @@ public class LoadBalancerFeignClient implements Client {
...
@@ -54,13 +54,24 @@ public class LoadBalancerFeignClient implements Client {
new
FeignOptionsClientConfig
(
options
)).
toResponse
();
new
FeignOptionsClientConfig
(
options
)).
toResponse
();
}
}
catch
(
ClientException
e
)
{
catch
(
ClientException
e
)
{
if
(
e
.
getCause
()
instanceof
IOException
)
{
IOException
io
=
findIOException
(
e
);
throw
IOException
.
class
.
cast
(
e
.
getCause
());
if
(
io
!=
null
)
{
throw
io
;
}
}
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
protected
IOException
findIOException
(
Throwable
t
)
{
if
(
t
==
null
)
{
return
null
;
}
if
(
t
instanceof
IOException
)
{
return
(
IOException
)
t
;
}
return
findIOException
(
t
.
getCause
());
}
public
Client
getDelegate
()
{
public
Client
getDelegate
()
{
return
this
.
delegate
;
return
this
.
delegate
;
}
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientRetryTests.java
View file @
b9a6876d
...
@@ -16,26 +16,18 @@
...
@@ -16,26 +16,18 @@
package
org
.
springframework
.
cloud
.
netflix
.
feign
.
ribbon
;
package
org
.
springframework
.
cloud
.
netflix
.
feign
.
ribbon
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.Proxy
;
import
java.lang.reflect.Proxy
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.cloud.netflix.feign.EnableFeignClients
;
import
org.springframework.cloud.netflix.feign.EnableFeignClients
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.ribbon.RibbonClient
;
import
org.springframework.cloud.netflix.ribbon.RibbonClient
;
...
@@ -44,7 +36,6 @@ import org.springframework.context.annotation.Bean;
...
@@ -44,7 +36,6 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -52,15 +43,23 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -52,15 +43,23 @@ import org.springframework.web.bind.annotation.RestController;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.loadbalancer.ServerList
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
/**
* Tests the Feign Retryer, not ribbon retry.
* @author Spencer Gibb
* @author Spencer Gibb
*/
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
FeignRibbonClientRetryTests
.
Application
.
class
)
@SpringApplicationConfiguration
(
classes
=
FeignRibbonClientRetryTests
.
Application
.
class
)
@WebAppConfiguration
@WebIntegrationTest
(
randomPort
=
true
,
value
=
{
"spring.application.name=feignclientretrytest"
,
@IntegrationTest
({
"server.port=0"
,
"spring.application.name=feignclienttest"
,
"feign.okhttp.enabled=false"
,
"feign.httpclient.enabled=false"
,
"localapp.ribbon.MaxAutoRetries=5"
,
"localapp.ribbon.MaxAutoRetriesNextServer=5"
,
"feign.hystrix.enabled=false"
,
})
"localapp.ribbon.OkToRetryOnAllOperations=true"
,
})
@DirtiesContext
@DirtiesContext
public
class
FeignRibbonClientRetryTests
{
public
class
FeignRibbonClientRetryTests
{
...
@@ -70,14 +69,13 @@ public class FeignRibbonClientRetryTests {
...
@@ -70,14 +69,13 @@ public class FeignRibbonClientRetryTests {
@Autowired
@Autowired
private
TestClient
testClient
;
private
TestClient
testClient
;
// @FeignClient(value = "http://localhost:9876", loadbalance = false)
@FeignClient
(
"localapp"
)
@FeignClient
(
"localapp"
)
protected
static
interface
TestClient
{
protected
interface
TestClient
{
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/hello"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/hello"
)
public
Hello
getHello
();
Hello
getHello
();
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/retryme"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/retryme"
)
public
int
retryMe
();
int
retryMe
();
}
}
@Configuration
@Configuration
...
@@ -101,12 +99,8 @@ public class FeignRibbonClientRetryTests {
...
@@ -101,12 +99,8 @@ public class FeignRibbonClientRetryTests {
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
new
SpringApplicationBuilder
(
Application
.
class
).
properties
(
new
SpringApplicationBuilder
(
Application
.
class
).
properties
(
"spring.application.name=feignclienttest"
,
"spring.application.name=feignclientretrytest"
,
"localapp.ribbon.MaxAutoRetries=5"
,
"localapp.ribbon.MaxAutoRetriesNextServer=5"
,
"localapp.ribbon.OkToRetryOnAllOperations=true"
,
"management.contextPath=/admin"
"management.contextPath=/admin"
// ,"local.server.port=9999"
).
run
(
args
);
).
run
(
args
);
}
}
}
}
...
...
spring-cloud-netflix-dependencies/pom.xml
View file @
b9a6876d
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
<eureka.version>
1.4.4
</eureka.version>
<eureka.version>
1.4.4
</eureka.version>
<feign.version>
8.15.1
</feign.version>
<feign.version>
8.15.1
</feign.version>
<hystrix.version>
1.5.1
</hystrix.version>
<hystrix.version>
1.5.1
</hystrix.version>
<ribbon.version>
2.1.
1
</ribbon.version>
<ribbon.version>
2.1.
3
</ribbon.version>
<servo.version>
0.10.1
</servo.version>
<servo.version>
0.10.1
</servo.version>
<zuul.version>
1.1.0
</zuul.version>
<zuul.version>
1.1.0
</zuul.version>
<rxjava.version>
1.1.1
</rxjava.version>
<rxjava.version>
1.1.1
</rxjava.version>
...
...
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