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
55a8195a
Commit
55a8195a
authored
Apr 16, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
throw more descriptive error if no ServiceInstance is found
parent
936a3b33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
RibbonClientHttpRequestFactory.java
.../cloud/netflix/ribbon/RibbonClientHttpRequestFactory.java
+3
-0
RibbonLoadBalancerClient.java
...mework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java
+2
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonClientHttpRequestFactory.java
View file @
55a8195a
...
...
@@ -60,6 +60,9 @@ public class RibbonClientHttpRequestFactory implements ClientHttpRequestFactory
throws
IOException
{
String
serviceId
=
originalUri
.
getHost
();
ServiceInstance
instance
=
loadBalancer
.
choose
(
serviceId
);
if
(
instance
==
null
)
{
throw
new
IllegalStateException
(
"No instances available for "
+
serviceId
);
}
URI
uri
=
loadBalancer
.
reconstructURI
(
instance
,
originalUri
);
//@formatter:off
IClientConfig
clientConfig
=
clientFactory
.
getClientConfig
(
instance
.
getServiceId
());
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java
View file @
55a8195a
...
...
@@ -23,6 +23,7 @@ import org.springframework.cloud.client.DefaultServiceInstance;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancerClient
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancerRequest
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ReflectionUtils
;
import
com.netflix.loadbalancer.ILoadBalancer
;
...
...
@@ -44,6 +45,7 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
@Override
public
URI
reconstructURI
(
ServiceInstance
instance
,
URI
original
)
{
Assert
.
notNull
(
instance
,
"instance can not be null"
);
String
serviceId
=
instance
.
getServiceId
();
RibbonLoadBalancerContext
context
=
this
.
clientFactory
.
getLoadBalancerContext
(
serviceId
);
...
...
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