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
66b4d4c6
Commit
66b4d4c6
authored
Oct 20, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up generics a bit
parent
1e12b745
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
SpringClientFactory.java
...ngframework/cloud/netflix/ribbon/SpringClientFactory.java
+7
-8
EurekaRibbonClientPreprocessor.java
...netflix/ribbon/eureka/EurekaRibbonClientPreprocessor.java
+2
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/SpringClientFactory.java
View file @
66b4d4c6
...
...
@@ -52,12 +52,12 @@ public class SpringClientFactory {
loadBalancer
=
getNamedLoadBalancer
(
restClientName
,
clientConfig
.
getClass
());
}
if
(
client
instanceof
AbstractLoadBalancerAwareClient
)
{
((
AbstractLoadBalancerAwareClient
)
client
).
setLoadBalancer
(
loadBalancer
);
((
AbstractLoadBalancerAwareClient
<?,?>
)
client
).
setLoadBalancer
(
loadBalancer
);
}
}
catch
(
Throwable
e
)
{
String
message
=
"Unable to InitializeAndAssociateNFLoadBalancer set for RestClient:"
+
restClientName
;
log
.
warn
(
message
,
e
);
log
.
warn
(
message
);
throw
new
ClientException
(
ClientException
.
ErrorType
.
CONFIGURATION
,
message
,
e
);
}
...
...
@@ -74,11 +74,11 @@ public class SpringClientFactory {
*
* @throws RuntimeException if an error occurs in creating the client.
*/
public
synchronized
IClient
getNamedClient
(
String
name
)
{
public
synchronized
IClient
<?,?>
getNamedClient
(
String
name
)
{
return
getNamedClient
(
name
,
DefaultClientConfigImpl
.
class
);
}
public
synchronized
<
C
extends
IClient
>
C
namedClient
(
String
name
,
Class
<
C
>
clientClass
)
{
public
synchronized
<
C
extends
IClient
<?,?>
>
C
namedClient
(
String
name
,
Class
<
C
>
clientClass
)
{
return
clientClass
.
cast
(
getNamedClient
(
name
,
DefaultClientConfigImpl
.
class
));
}
...
...
@@ -87,7 +87,7 @@ public class SpringClientFactory {
*
* @throws RuntimeException if an error occurs in creating the client.
*/
public
synchronized
IClient
getNamedClient
(
String
name
,
Class
<?
extends
IClientConfig
>
configClass
)
{
public
synchronized
IClient
<?,?>
getNamedClient
(
String
name
,
Class
<?
extends
IClientConfig
>
configClass
)
{
if
(
simpleClientMap
.
get
(
name
)
!=
null
)
{
return
simpleClientMap
.
get
(
name
);
}
...
...
@@ -103,7 +103,7 @@ public class SpringClientFactory {
*
* @throws ClientException if any error occurs, or if the client with the same name already exists
*/
public
synchronized
IClient
createNamedClient
(
String
name
,
Class
<?
extends
IClientConfig
>
configClass
)
throws
ClientException
{
public
synchronized
IClient
<?,?>
createNamedClient
(
String
name
,
Class
<?
extends
IClientConfig
>
configClass
)
throws
ClientException
{
IClientConfig
config
=
getNamedConfig
(
name
,
configClass
);
return
registerClientFromProperties
(
name
,
config
);
}
...
...
@@ -183,10 +183,9 @@ public class SpringClientFactory {
* @param className Class name of the object
* @param clientConfig IClientConfig object used for initialization.
*/
@SuppressWarnings
(
"unchecked"
)
public
Object
instantiateInstanceWithClientConfig
(
String
className
,
IClientConfig
clientConfig
)
throws
InstantiationException
,
IllegalAccessException
,
ClassNotFoundException
{
Class
clazz
=
Class
.
forName
(
className
);
Class
<?>
clazz
=
Class
.
forName
(
className
);
if
(
IClientConfigAware
.
class
.
isAssignableFrom
(
clazz
))
{
IClientConfigAware
obj
=
(
IClientConfigAware
)
clazz
.
newInstance
();
obj
.
initWithNiwsConfig
(
clientConfig
);
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientPreprocessor.java
View file @
66b4d4c6
...
...
@@ -21,7 +21,7 @@ import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
/**
* Preprocessor that configures defaults for eureka-discovered ribbon clients.
* Such as:
@zone
, NIWSServerListClassName, DeploymentContextBasedVipAddresses,
* Such as:
<code>@zone</code>
, NIWSServerListClassName, DeploymentContextBasedVipAddresses,
* NFLoadBalancerRuleClassName, NIWSServerListFilterClassName and more
*
* @author Spencer Gibb
...
...
@@ -58,6 +58,7 @@ public class EurekaRibbonClientPreprocessor implements RibbonClientPreprocessor
setProp
(
serviceId
,
DeploymentContextBasedVipAddresses
.
key
(),
serviceId
);
setProp
(
serviceId
,
NFLoadBalancerRuleClassName
.
key
(),
ZoneAvoidanceRule
.
class
.
getName
());
// TODO: use bean name indirection to get this filter to be a @Bean
setProp
(
serviceId
,
NIWSServerListFilterClassName
.
key
(),
ZonePreferenceServerListFilter
.
class
.
getName
());
setProp
(
serviceId
,
EnableZoneAffinity
.
key
(),
"true"
);
...
...
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