Commit 1d93428c by danmo

修改线程池阻塞报错

1 parent 56b2cd7d
...@@ -21,8 +21,14 @@ public class Threads ...@@ -21,8 +21,14 @@ public class Threads
/** /**
* 创建线程池 * 创建线程池
*/ */
public static final ThreadPoolExecutor SINGLE_THREAD_POOL = new ThreadPoolExecutor(CORE_POOL_SIZE, CORE_POOL_SIZE+1, 10l, TimeUnit.SECONDS, public static final ThreadPoolExecutor SINGLE_THREAD_POOL = new ThreadPoolExecutor(CORE_POOL_SIZE, CORE_POOL_SIZE + 1, 10l, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(1024),NAMED_THREAD_FACTORY); new SynchronousQueue<>(), NAMED_THREAD_FACTORY, (r, executor) -> {
try {
executor.getQueue().put(r);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
......
...@@ -132,12 +132,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -132,12 +132,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
Arrays.asList(followUserList.getFollow_user()) Arrays.asList(followUserList.getFollow_user())
.stream().forEach(k -> { .stream().forEach(k -> {
try { try {
Threads.SINGLE_THREAD_POOL.execute(new Runnable() { Threads.SINGLE_THREAD_POOL.execute(() -> {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext); SecurityContextHolder.setContext(securityContext);
weFlowerCustomerHandle(k); weFlowerCustomerHandle(k);
}
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!