Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
spring-boot-starter-dsp
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
shenjiaqing
spring-boot-starter-dsp
Commits
9b985c0b
Commit
9b985c0b
authored
Jan 17, 2022
by
江洋洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
warmup bug修复
parent
a15e1afb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
build.gradle
build.gradle
+1
-1
CacheConfig.java
...com/duiba/spring/boot/starter/dsp/warmup/CacheConfig.java
+3
-2
HttpRequestUtils.java
...uiba/spring/boot/starter/dsp/warmup/HttpRequestUtils.java
+1
-1
No files found.
build.gradle
View file @
9b985c0b
...
@@ -38,7 +38,7 @@ allprojects {
...
@@ -38,7 +38,7 @@ allprojects {
}
}
group
=
"cn.com.duiba.boot"
group
=
"cn.com.duiba.boot"
version
=
"0.0.3
2
"
version
=
"0.0.3
4
"
}
}
subprojects
{
subprojects
{
...
...
spring-boot-starter-dsp-warmup/src/main/java/cn/com/duiba/spring/boot/starter/dsp/warmup/CacheConfig.java
View file @
9b985c0b
...
@@ -143,14 +143,15 @@ public class CacheConfig {
...
@@ -143,14 +143,15 @@ public class CacheConfig {
return
;
return
;
}
}
logger
.
info
(
"container of all registered AppInfo size: {}"
,
instances
.
size
());
logger
.
info
(
"container of all registered AppInfo size: {}"
,
instances
.
size
());
List
<
InstanceInfo
>
list
=
instances
.
stream
().
sorted
(
Comparator
.
comparing
(
InstanceInfo:
:
getLastUpdatedTimestamp
).
reversed
(
)).
collect
(
Collectors
.
toList
());
List
<
InstanceInfo
>
list
=
instances
.
stream
().
sorted
(
(
o1
,
o2
)
->
(
int
)
(
o2
.
getLeaseInfo
().
getServiceUpTimestamp
()-
o1
.
getLeaseInfo
().
getServiceUpTimestamp
()
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
warn
(
"Cache preheating failed,because 服务启动获取【"
+
appName
+
"】列表信息为空"
);
logger
.
warn
(
"Cache preheating failed,because 服务启动获取【"
+
appName
+
"】列表信息为空"
);
return
;
return
;
}
}
logger
.
info
(
"打印warmup获取备份数据实例信息:{}"
,
JSONObject
.
toJSONString
(
list
.
get
(
0
)));
String
result
=
HttpRequestUtils
.
sendHttp
(
list
.
get
(
0
).
getHomePageUrl
()
+
"/local/getCacheMap"
,
null
,
appName
);
String
result
=
HttpRequestUtils
.
sendHttp
(
list
.
get
(
0
).
getHomePageUrl
()
+
"/local/getCacheMap"
,
null
,
appName
);
if
(
StringUtils
.
isBlank
(
result
))
{
if
(
StringUtils
.
isBlank
(
result
))
{
logger
.
warn
(
"Cache preheating failed,because request {} ,response {}
, instance status{}"
,
list
.
get
(
0
).
getHomePageUrl
()
+
"/local/getCacheMap"
,
result
,
list
.
get
(
0
).
getStatus
()
);
logger
.
warn
(
"Cache preheating failed,because request {} ,response {}
"
,
list
.
get
(
0
).
getHomePageUrl
()
+
"/local/getCacheMap"
,
result
);
return
;
return
;
}
}
...
...
spring-boot-starter-dsp-warmup/src/main/java/cn/com/duiba/spring/boot/starter/dsp/warmup/HttpRequestUtils.java
View file @
9b985c0b
...
@@ -29,7 +29,7 @@ public class HttpRequestUtils {
...
@@ -29,7 +29,7 @@ public class HttpRequestUtils {
*/
*/
public
static
String
sendHttp
(
String
url
,
Map
<
String
,
String
>
param
,
String
appName
){
public
static
String
sendHttp
(
String
url
,
Map
<
String
,
String
>
param
,
String
appName
){
CloseableHttpClient
httpClient
=
HttpClientBuilder
.
create
()
CloseableHttpClient
httpClient
=
HttpClientBuilder
.
create
()
.
setDefaultRequestConfig
(
RequestConfig
.
custom
().
setConnectTimeout
(
1
50
).
setSocketTimeout
(
150
).
setConnectionRequestTimeout
(
1
00
).
build
())
.
setDefaultRequestConfig
(
RequestConfig
.
custom
().
setConnectTimeout
(
1
0000
).
setSocketTimeout
(
10000
).
setConnectionRequestTimeout
(
100
00
).
build
())
.
setMaxConnPerRoute
(
1
)
.
setMaxConnPerRoute
(
1
)
.
setMaxConnTotal
(
1000
)
.
setMaxConnTotal
(
1000
)
.
evictExpiredConnections
()
//开启后台线程定时清理失效的连接,每隔10秒主动扫描并逐出超时的连接(超过keepAliveTimeout)
.
evictExpiredConnections
()
//开启后台线程定时清理失效的连接,每隔10秒主动扫描并逐出超时的连接(超过keepAliveTimeout)
...
...
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