Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
thythm
ribbon
提交
0b2253fa
R
ribbon
项目概览
thythm
/
ribbon
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
ribbon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0b2253fa
编写于
5月 29, 2019
作者:
E
elandau
提交者:
GitHub
5月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #430 from elandau/misc
config: Misc cleanup
上级
e590d000
d27a51cf
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
16 addition
and
24 deletion
+16
-24
ribbon-core/src/main/java/com/netflix/client/RequestSpecificRetryHandler.java
.../java/com/netflix/client/RequestSpecificRetryHandler.java
+2
-2
ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java
...ava/com/netflix/client/config/ReloadableClientConfig.java
+2
-2
ribbon-eureka/src/main/java/com/netflix/niws/loadbalancer/DiscoveryEnabledNIWSServerList.java
...lix/niws/loadbalancer/DiscoveryEnabledNIWSServerList.java
+1
-1
ribbon-eureka/src/test/java/com/netflix/niws/loadbalancer/DiscoveryEnabledLoadBalancerSupportsPortOverrideTest.java
...DiscoveryEnabledLoadBalancerSupportsPortOverrideTest.java
+0
-1
ribbon-httpclient/src/main/java/com/netflix/niws/client/http/RestClient.java
...rc/main/java/com/netflix/niws/client/http/RestClient.java
+10
-17
ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/http/LoadBalancingHttpClient.java
.../ribbon/transport/netty/http/LoadBalancingHttpClient.java
+1
-1
未找到文件。
ribbon-core/src/main/java/com/netflix/client/RequestSpecificRetryHandler.java
浏览文件 @
0b2253fa
...
@@ -35,10 +35,10 @@ public class RequestSpecificRetryHandler implements RetryHandler {
...
@@ -35,10 +35,10 @@ public class RequestSpecificRetryHandler implements RetryHandler {
this
.
okToRetryOnAllErrors
=
okToRetryOnAllErrors
;
this
.
okToRetryOnAllErrors
=
okToRetryOnAllErrors
;
this
.
fallback
=
baseRetryHandler
;
this
.
fallback
=
baseRetryHandler
;
if
(
requestConfig
!=
null
)
{
if
(
requestConfig
!=
null
)
{
Optional
.
ofNullable
(
requestConfig
.
get
(
CommonClientConfigKey
.
MaxAutoRetries
)
).
ifPresent
(
requestConfig
.
getIfSet
(
CommonClientConfigKey
.
MaxAutoRetries
).
ifPresent
(
value
->
retrySameServer
=
value
value
->
retrySameServer
=
value
);
);
Optional
.
ofNullable
(
requestConfig
.
get
(
CommonClientConfigKey
.
MaxAutoRetriesNextServer
)
).
ifPresent
(
requestConfig
.
getIfSet
(
CommonClientConfigKey
.
MaxAutoRetriesNextServer
).
ifPresent
(
value
->
retryNextServer
=
value
value
->
retryNextServer
=
value
);
);
}
}
...
...
ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java
浏览文件 @
0b2253fa
...
@@ -456,10 +456,10 @@ public abstract class ReloadableClientConfig implements IClientConfig {
...
@@ -456,10 +456,10 @@ public abstract class ReloadableClientConfig implements IClientConfig {
private
String
generateToString
()
{
private
String
generateToString
()
{
return
"ClientConfig:"
+
internalProperties
.
entrySet
().
stream
()
return
"ClientConfig:"
+
internalProperties
.
entrySet
().
stream
()
.
map
(
t
->
{
.
map
(
t
->
{
if
(
t
.
getKey
().
key
().
endsWith
(
"Password"
))
{
if
(
t
.
getKey
().
key
().
endsWith
(
"Password"
)
&&
t
.
getValue
().
isPresent
()
)
{
return
t
.
getKey
()
+
":***"
;
return
t
.
getKey
()
+
":***"
;
}
}
return
t
.
getKey
()
+
":"
+
t
.
getValue
();
return
t
.
getKey
()
+
":"
+
t
.
getValue
()
.
orElse
(
null
)
;
})
})
.
collect
(
Collectors
.
joining
(
", "
));
.
collect
(
Collectors
.
joining
(
", "
));
}
}
...
...
ribbon-eureka/src/main/java/com/netflix/niws/loadbalancer/DiscoveryEnabledNIWSServerList.java
浏览文件 @
0b2253fa
...
@@ -117,7 +117,7 @@ public class DiscoveryEnabledNIWSServerList extends AbstractServerList<Discovery
...
@@ -117,7 +117,7 @@ public class DiscoveryEnabledNIWSServerList extends AbstractServerList<Discovery
shouldUseIpAddr
=
clientConfig
.
getOrDefault
(
CommonClientConfigKey
.
UseIPAddrForServer
);
shouldUseIpAddr
=
clientConfig
.
getOrDefault
(
CommonClientConfigKey
.
UseIPAddrForServer
);
// override client configuration and use client-defined port
// override client configuration and use client-defined port
if
(
clientConfig
.
get
(
CommonClientConfigKey
.
ForceClientPortConfiguration
,
false
)){
if
(
clientConfig
.
get
(
CommonClientConfigKey
.
ForceClientPortConfiguration
,
false
))
{
if
(
isSecure
)
{
if
(
isSecure
)
{
final
Integer
port
=
clientConfig
.
get
(
CommonClientConfigKey
.
SecurePort
);
final
Integer
port
=
clientConfig
.
get
(
CommonClientConfigKey
.
SecurePort
);
if
(
port
!=
null
)
{
if
(
port
!=
null
)
{
...
...
ribbon-eureka/src/test/java/com/netflix/niws/loadbalancer/DiscoveryEnabledLoadBalancerSupportsPortOverrideTest.java
浏览文件 @
0b2253fa
...
@@ -181,7 +181,6 @@ public class DiscoveryEnabledLoadBalancerSupportsPortOverrideTest {
...
@@ -181,7 +181,6 @@ public class DiscoveryEnabledLoadBalancerSupportsPortOverrideTest {
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.SecurePort"
,
"6002"
);
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.SecurePort"
,
"6002"
);
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.TargetRegion"
,
"region"
);
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.TargetRegion"
,
"region"
);
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.NIWSServerListClassName"
,
DiscoveryEnabledNIWSServerList
.
class
.
getName
());
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.NIWSServerListClassName"
,
DiscoveryEnabledNIWSServerList
.
class
.
getName
());
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.ForceClientPortConfiguration"
,
"true"
);
ConfigurationManager
.
getConfigInstance
().
setProperty
(
"DiscoveryEnabled.testSecureVipPortCanBeOverriden.ribbon.ForceClientPortConfiguration"
,
"true"
);
DiscoveryEnabledNIWSServerList
deList
=
new
DiscoveryEnabledNIWSServerList
();
DiscoveryEnabledNIWSServerList
deList
=
new
DiscoveryEnabledNIWSServerList
();
...
...
ribbon-httpclient/src/main/java/com/netflix/niws/client/http/RestClient.java
浏览文件 @
0b2253fa
...
@@ -147,19 +147,19 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
...
@@ -147,19 +147,19 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
super
.
initWithNiwsConfig
(
clientConfig
);
super
.
initWithNiwsConfig
(
clientConfig
);
this
.
ncc
=
clientConfig
;
this
.
ncc
=
clientConfig
;
this
.
restClientName
=
ncc
.
getClientName
();
this
.
restClientName
=
ncc
.
getClientName
();
this
.
isSecure
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
IsSecure
,
this
.
isSecure
);
this
.
isSecure
=
ncc
.
get
(
CommonClientConfigKey
.
IsSecure
,
this
.
isSecure
);
this
.
isHostnameValidationRequired
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
IsHostnameValidationRequired
,
this
.
isHostnameValidationRequired
);
this
.
isHostnameValidationRequired
=
ncc
.
get
(
CommonClientConfigKey
.
IsHostnameValidationRequired
,
this
.
isHostnameValidationRequired
);
this
.
isClientAuthRequired
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
IsClientAuthRequired
,
this
.
isClientAuthRequired
);
this
.
isClientAuthRequired
=
ncc
.
get
(
CommonClientConfigKey
.
IsClientAuthRequired
,
this
.
isClientAuthRequired
);
this
.
bFollowRedirects
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
FollowRedirects
,
true
);
this
.
bFollowRedirects
=
ncc
.
get
(
CommonClientConfigKey
.
FollowRedirects
,
true
);
this
.
ignoreUserToken
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
IgnoreUserTokenInConnectionPoolForSecureClient
,
this
.
ignoreUserToken
);
this
.
ignoreUserToken
=
ncc
.
get
(
CommonClientConfigKey
.
IgnoreUserTokenInConnectionPoolForSecureClient
,
this
.
ignoreUserToken
);
this
.
config
=
new
DefaultApacheHttpClient4Config
();
this
.
config
=
new
DefaultApacheHttpClient4Config
();
this
.
config
.
getProperties
().
put
(
this
.
config
.
getProperties
().
put
(
ApacheHttpClient4Config
.
PROPERTY_CONNECT_TIMEOUT
,
ApacheHttpClient4Config
.
PROPERTY_CONNECT_TIMEOUT
,
ncc
.
get
OrDefault
(
CommonClientConfigKey
.
ConnectTimeout
));
ncc
.
get
(
CommonClientConfigKey
.
ConnectTimeout
));
this
.
config
.
getProperties
().
put
(
this
.
config
.
getProperties
().
put
(
ApacheHttpClient4Config
.
PROPERTY_READ_TIMEOUT
,
ApacheHttpClient4Config
.
PROPERTY_READ_TIMEOUT
,
ncc
.
get
OrDefault
(
CommonClientConfigKey
.
ReadTimeout
));
ncc
.
get
(
CommonClientConfigKey
.
ReadTimeout
));
this
.
restClient
=
apacheHttpClientSpecificInitialization
();
this
.
restClient
=
apacheHttpClientSpecificInitialization
();
this
.
setRetryHandler
(
new
HttpClientLoadBalancerErrorHandler
(
ncc
));
this
.
setRetryHandler
(
new
HttpClientLoadBalancerErrorHandler
(
ncc
));
...
@@ -470,13 +470,6 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
...
@@ -470,13 +470,6 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
task
.
getHeaders
(),
task
.
getQueryParams
(),
config
,
task
.
getEntity
());
task
.
getHeaders
(),
task
.
getQueryParams
(),
config
,
task
.
getEntity
());
}
}
private
boolean
getBooleanFromConfig
(
IClientConfig
overriddenClientConfig
,
IClientConfigKey
<
Boolean
>
key
,
boolean
defaultValue
)
{
return
Optional
.
ofNullable
(
overriddenClientConfig
)
.
map
(
config
->
config
.
get
(
key
))
.
orElse
(
defaultValue
);
}
@Override
@Override
protected
int
getDefaultPortFromScheme
(
String
scheme
)
{
protected
int
getDefaultPortFromScheme
(
String
scheme
)
{
int
port
=
super
.
getDefaultPortFromScheme
(
scheme
);
int
port
=
super
.
getDefaultPortFromScheme
(
scheme
);
...
@@ -489,7 +482,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
...
@@ -489,7 +482,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
@Override
@Override
protected
Pair
<
String
,
Integer
>
deriveSchemeAndPortFromPartialUri
(
URI
uri
)
{
protected
Pair
<
String
,
Integer
>
deriveSchemeAndPortFromPartialUri
(
URI
uri
)
{
boolean
isSecure
=
getBooleanFromConfig
(
ncc
,
CommonClientConfigKey
.
IsSecure
,
this
.
isSecure
);
boolean
isSecure
=
ncc
.
get
(
CommonClientConfigKey
.
IsSecure
,
this
.
isSecure
);
String
scheme
=
uri
.
getScheme
();
String
scheme
=
uri
.
getScheme
();
if
(
scheme
!=
null
)
{
if
(
scheme
!=
null
)
{
isSecure
=
scheme
.
equalsIgnoreCase
(
"https"
);
isSecure
=
scheme
.
equalsIgnoreCase
(
"https"
);
...
@@ -507,7 +500,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
...
@@ -507,7 +500,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
scheme
=
"http"
;
scheme
=
"http"
;
}
}
}
}
return
new
Pair
<
String
,
Integer
>(
scheme
,
port
);
return
new
Pair
<>(
scheme
,
port
);
}
}
private
HttpResponse
execute
(
HttpRequest
.
Verb
verb
,
URI
uri
,
private
HttpResponse
execute
(
HttpRequest
.
Verb
verb
,
URI
uri
,
...
@@ -516,7 +509,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
...
@@ -516,7 +509,7 @@ public class RestClient extends AbstractLoadBalancerAwareClient<HttpRequest, Htt
HttpClientResponse
thisResponse
=
null
;
HttpClientResponse
thisResponse
=
null
;
final
boolean
bbFollowRedirects
=
Optional
.
ofNullable
(
overriddenClientConfig
)
final
boolean
bbFollowRedirects
=
Optional
.
ofNullable
(
overriddenClientConfig
)
.
map
(
config
->
config
.
get
(
CommonClientConfigKey
.
FollowRedirects
,
b
FollowRedirects
))
.
flatMap
(
config
->
config
.
getIfSet
(
CommonClientConfigKey
.
FollowRedirects
))
.
orElse
(
bFollowRedirects
);
.
orElse
(
bFollowRedirects
);
restClient
.
setFollowRedirects
(
bbFollowRedirects
);
restClient
.
setFollowRedirects
(
bbFollowRedirects
);
...
...
ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/http/LoadBalancingHttpClient.java
浏览文件 @
0b2253fa
...
@@ -456,7 +456,7 @@ public class LoadBalancingHttpClient<I, O> extends LoadBalancingRxClientWithPool
...
@@ -456,7 +456,7 @@ public class LoadBalancingHttpClient<I, O> extends LoadBalancingRxClientWithPool
}
}
int
port
=
uri
.
getPort
();
int
port
=
uri
.
getPort
();
if
(
port
<
0
)
{
if
(
port
<
0
)
{
if
(
Optional
.
ofNullable
(
clientConfig
.
get
(
IClientConfigKey
.
Keys
.
IsSecure
)).
orElse
(
false
))
{
if
(
clientConfig
.
get
(
IClientConfigKey
.
Keys
.
IsSecure
,
false
))
{
port
=
443
;
port
=
443
;
}
else
{
}
else
{
port
=
80
;
port
=
80
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录