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
0af99769
Commit
0af99769
authored
Feb 09, 2017
by
Ryan Baxter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding missing commit from PR #1457
parent
c6a3157f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
17 deletions
+12
-17
FeignClientsConfiguration.java
...mework/cloud/netflix/feign/FeignClientsConfiguration.java
+8
-2
FeignLoadBalancer.java
...amework/cloud/netflix/feign/ribbon/FeignLoadBalancer.java
+3
-14
FeignClientOverrideDefaultsTests.java
...cloud/netflix/feign/FeignClientOverrideDefaultsTests.java
+1
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClientsConfiguration.java
View file @
0af99769
...
...
@@ -105,10 +105,16 @@ public class FeignClientsConfiguration {
}
@Bean
@ConditionalOnMissingBean
public
Retryer
feignRetryer
()
{
return
Retryer
.
NEVER_RETRY
;
}
@Bean
@Scope
(
"prototype"
)
@ConditionalOnMissingBean
public
Feign
.
Builder
feignBuilder
()
{
return
Feign
.
builder
().
retryer
(
Retryer
.
NEVER_RETRY
);
public
Feign
.
Builder
feignBuilder
(
Retryer
retryer
)
{
return
Feign
.
builder
().
retryer
(
retryer
);
}
@Bean
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/FeignLoadBalancer.java
View file @
0af99769
...
...
@@ -97,11 +97,13 @@ public class FeignLoadBalancer extends
}
LoadBalancedRetryPolicy
retryPolicy
=
loadBalancedRetryPolicyFactory
.
create
(
this
.
getClientName
(),
this
);
retryTemplate
.
setRetryPolicy
(
retryPolicy
==
null
?
new
NeverRetryPolicy
()
:
new
Interceptor
RetryPolicy
(
request
.
toHttpRequest
(),
retryPolicy
,
this
,
this
.
getClientName
()));
:
new
Feign
RetryPolicy
(
request
.
toHttpRequest
(),
retryPolicy
,
this
,
this
.
getClientName
()));
return
retryTemplate
.
execute
(
new
RetryCallback
<
RibbonResponse
,
IOException
>()
{
@Override
public
RibbonResponse
doWithRetry
(
RetryContext
retryContext
)
throws
IOException
{
Request
feignRequest
=
null
;
//on retries the policy will choose the server and set it in the context
// extract the server and update the request being made
if
(
retryContext
instanceof
LoadBalancedRetryContext
)
{
ServiceInstance
service
=
((
LoadBalancedRetryContext
)
retryContext
).
getServiceInstance
();
if
(
service
!=
null
)
{
...
...
@@ -120,19 +122,6 @@ public class FeignLoadBalancer extends
@Override
public
RequestSpecificRetryHandler
getRequestSpecificRetryHandler
(
RibbonRequest
request
,
IClientConfig
requestConfig
)
{
// if (this.clientConfig.get(CommonClientConfigKey.OkToRetryOnAllOperations,
// false)) {
// return new RequestSpecificRetryHandler(true, true, this.getRetryHandler(),
// requestConfig);
// }
// if (!request.toRequest().method().equals("GET")) {
// return new RequestSpecificRetryHandler(true, false, this.getRetryHandler(),
// requestConfig);
// }
// else {
// return new RequestSpecificRetryHandler(true, true, this.getRetryHandler(),
// requestConfig);
// }
return
new
RequestSpecificRetryHandler
(
false
,
false
,
this
.
getRetryHandler
(),
requestConfig
);
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/FeignClientOverrideDefaultsTests.java
View file @
0af99769
...
...
@@ -108,7 +108,7 @@ public class FeignClientOverrideDefaultsTests {
@Test
public
void
overrideRetryer
()
{
assert
Null
(
this
.
context
.
getInstance
(
"foo"
,
Retryer
.
class
));
assert
Equals
(
Retryer
.
NEVER_RETRY
,
this
.
context
.
getInstance
(
"foo"
,
Retryer
.
class
));
Retryer
.
Default
.
class
.
cast
(
this
.
context
.
getInstance
(
"bar"
,
Retryer
.
class
));
}
...
...
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