Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
78f49de1
Commit
78f49de1
authored
Sep 07, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
es同步和田玉
parent
4bf70eae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
ch-admin-api/src/main/java/com/wwdz/ch/admin/job/SynCoinJob.java
...n-api/src/main/java/com/wwdz/ch/admin/job/SynCoinJob.java
+13
-3
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/job/SynCoinJob.java
View file @
78f49de1
...
@@ -43,7 +43,7 @@ public class SynCoinJob {
...
@@ -43,7 +43,7 @@ public class SynCoinJob {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SynCoinJob
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SynCoinJob
.
class
);
private
String
QUANKU_SYN_TO_ES_TASK_KEY
=
"QUANKU_SYN
_TO_ES_TASK_KEY"
;
private
String
SYN_NEPHRITE_TO_ES_TASK_KEY
=
"SYN_NEPHRITE
_TO_ES_TASK_KEY"
;
@Autowired
@Autowired
ItemDao
itemDao
;
ItemDao
itemDao
;
...
@@ -188,6 +188,11 @@ public class SynCoinJob {
...
@@ -188,6 +188,11 @@ public class SynCoinJob {
public
void
synItemToEs
()
{
public
void
synItemToEs
()
{
RLock
lock
=
redissonClient
.
getLock
(
SYN_NEPHRITE_TO_ES_TASK_KEY
);
if
(!
lock
.
tryLock
())
{
logger
.
warn
(
"当前服务实例: {} 获取锁失败,锁被占用, 不允许执行同步和田玉数据到ES作业"
,
Thread
.
currentThread
().
getId
());
return
;
}
try
{
try
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
...
@@ -211,12 +216,17 @@ public class SynCoinJob {
...
@@ -211,12 +216,17 @@ public class SynCoinJob {
logger
.
info
(
">>>>>>>>>>>>>>>>>数据同步es 完成 SUCCESS!!!!! <<<<<<<<<<<<<<<<<"
);
logger
.
info
(
">>>>>>>>>>>>>>>>>数据同步es 完成 SUCCESS!!!!! <<<<<<<<<<<<<<<<<"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"同步数据到es error {}"
,
e
);
logger
.
error
(
"同步数据到es error {}"
,
e
);
}
finally
{
if
(
lock
!=
null
&&
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
logger
.
info
(
"======================== 线程id: {} , 同步和田玉数据到ES作业 释放锁成功 ========================"
,
Thread
.
currentThread
().
getId
());
}
}
}
}
}
public
void
syn
(){
public
void
syn
(){
RLock
lock
=
redissonClient
.
getLock
(
QUANKU_SYN
_TO_ES_TASK_KEY
);
/* RLock lock = redissonClient.getLock(SYN_NEPHRITE
_TO_ES_TASK_KEY);
if (!lock.tryLock()) {
if (!lock.tryLock()) {
logger.warn("当前服务实例获取锁成功: {} 获取锁失败,锁被占用, 不允许执行同步订单作业", Thread.currentThread().getId());
logger.warn("当前服务实例获取锁成功: {} 获取锁失败,锁被占用, 不允许执行同步订单作业", Thread.currentThread().getId());
return;
return;
...
@@ -230,6 +240,6 @@ public class SynCoinJob {
...
@@ -230,6 +240,6 @@ public class SynCoinJob {
lock.unlock();
lock.unlock();
logger.info("======================== 线程id: {} , 释放锁成功 ========================", Thread.currentThread().getId());
logger.info("======================== 线程id: {} , 释放锁成功 ========================", Thread.currentThread().getId());
}
}
}
}
*/
}
}
}
}
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