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
6ea7012e
Commit
6ea7012e
authored
Aug 02, 2021
by
shenjiaqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
3143f352
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
build.gradle
build.gradle
+1
-1
CacheConfig.java
...com/duiba/spring/boot/starter/dsp/warmup/CacheConfig.java
+6
-1
No files found.
build.gradle
View file @
6ea7012e
...
@@ -38,7 +38,7 @@ allprojects {
...
@@ -38,7 +38,7 @@ allprojects {
}
}
group
=
"cn.com.duiba.boot"
group
=
"cn.com.duiba.boot"
version
=
"0.0.1
1
"
version
=
"0.0.1
2-SNAPSHOT
"
}
}
subprojects
{
subprojects
{
...
...
spring-boot-starter-dsp-warmup/src/main/java/cn/com/duiba/spring/boot/starter/dsp/warmup/CacheConfig.java
View file @
6ea7012e
...
@@ -109,7 +109,7 @@ public class CacheConfig {
...
@@ -109,7 +109,7 @@ public class CacheConfig {
}
}
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
warn
(
""
,
e
);
logger
.
warn
(
"
缓存备份失败
"
,
e
);
}
}
}
}
}
}
...
@@ -119,12 +119,17 @@ public class CacheConfig {
...
@@ -119,12 +119,17 @@ public class CacheConfig {
@Order
(
Ordered
.
LOWEST_PRECEDENCE
-
1
)
@Order
(
Ordered
.
LOWEST_PRECEDENCE
-
1
)
public
void
onServerCache
(){
public
void
onServerCache
(){
try
{
try
{
logger
.
info
(
"进来了"
);
// 本地缓存预热开关 : 默认关闭
// 本地缓存预热开关 : 默认关闭
if
(!
cacheEnable
)
{
if
(!
cacheEnable
)
{
logger
.
warn
(
"Cache preheating failed,because cacheEnable is false"
);
logger
.
warn
(
"Cache preheating failed,because cacheEnable is false"
);
return
;
return
;
}
}
List
<
InstanceInfo
>
instances
=
eurekaClient
.
getApplication
(
appName
).
getInstances
();
List
<
InstanceInfo
>
instances
=
eurekaClient
.
getApplication
(
appName
).
getInstances
();
if
(
CollectionUtils
.
isEmpty
(
instances
))
{
logger
.
warn
(
"获取容器列表为空!"
);
return
;
}
logger
.
info
(
"container of all registered AppInfo : {}"
,
instances
);
logger
.
info
(
"container of all registered AppInfo : {}"
,
instances
);
List
<
InstanceInfo
>
list
=
instances
.
stream
().
sorted
(
Comparator
.
comparing
(
InstanceInfo:
:
getLastUpdatedTimestamp
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
InstanceInfo
>
list
=
instances
.
stream
().
sorted
(
Comparator
.
comparing
(
InstanceInfo:
:
getLastUpdatedTimestamp
).
reversed
()).
collect
(
Collectors
.
toList
());
logger
.
info
(
"container of all registered AppInfo : {}"
,
list
);
logger
.
info
(
"container of all registered AppInfo : {}"
,
list
);
...
...
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