Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c3a1f53d
authored
Jan 05, 2021
by
sunxiwang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改线程池阻塞报错
1 parent
ab46f160
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
linkwe-common/src/main/java/com/linkwechat/common/utils/Threads.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-common/src/main/java/com/linkwechat/common/utils/Threads.java
View file @
c3a1f53
...
...
@@ -21,8 +21,14 @@ public class Threads
/**
* 创建线程池
*/
public
static
final
ThreadPoolExecutor
SINGLE_THREAD_POOL
=
new
ThreadPoolExecutor
(
CORE_POOL_SIZE
,
CORE_POOL_SIZE
+
1
,
10
l
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(
1024
),
NAMED_THREAD_FACTORY
);
public
static
final
ThreadPoolExecutor
SINGLE_THREAD_POOL
=
new
ThreadPoolExecutor
(
CORE_POOL_SIZE
,
CORE_POOL_SIZE
+
1
,
10
l
,
TimeUnit
.
SECONDS
,
new
SynchronousQueue
<>(),
NAMED_THREAD_FACTORY
,
(
r
,
executor
)
->
{
try
{
executor
.
getQueue
().
put
(
r
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
c3a1f53
...
...
@@ -132,12 +132,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
Arrays
.
asList
(
followUserList
.
getFollow_user
())
.
stream
().
forEach
(
k
->
{
try
{
Threads
.
SINGLE_THREAD_POOL
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
SecurityContextHolder
.
setContext
(
securityContext
);
weFlowerCustomerHandle
(
k
);
}
Threads
.
SINGLE_THREAD_POOL
.
execute
(()
->
{
SecurityContextHolder
.
setContext
(
securityContext
);
weFlowerCustomerHandle
(
k
);
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment