|
@@ -40,7 +40,7 @@ public class DynamicMyThreadPool extends ThreadPoolTaskExecutor {
|
|
@Bean
|
|
@Bean
|
|
@Primary
|
|
@Primary
|
|
public Executor taskThreadPool() {
|
|
public Executor taskThreadPool() {
|
|
- synchronized (this.poolSizeMonitor) {
|
|
|
|
|
|
+ synchronized (poolSizeMonitor) {
|
|
return this.createThreadPool();
|
|
return this.createThreadPool();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -49,7 +49,7 @@ public class DynamicMyThreadPool extends ThreadPoolTaskExecutor {
|
|
* 刷新线程池状态
|
|
* 刷新线程池状态
|
|
*/
|
|
*/
|
|
public void refresh(int corePoolSize) {
|
|
public void refresh(int corePoolSize) {
|
|
- synchronized (this.poolSizeMonitor) {
|
|
|
|
|
|
+ synchronized (poolSizeMonitor) {
|
|
log.info(">>>>>>>>>>>> 开始刷新线程池参数 >>>>>>>>>>>");
|
|
log.info(">>>>>>>>>>>> 开始刷新线程池参数 >>>>>>>>>>>");
|
|
if (!this.dynamicThreadPoolTaskExecutor.getThreadPoolExecutor().isShutdown() && !this.dynamicThreadPoolTaskExecutor.getThreadPoolExecutor().isTerminated()) {
|
|
if (!this.dynamicThreadPoolTaskExecutor.getThreadPoolExecutor().isShutdown() && !this.dynamicThreadPoolTaskExecutor.getThreadPoolExecutor().isTerminated()) {
|
|
this.dynamicThreadPoolTaskExecutor.setCorePoolSize(corePoolSize);
|
|
this.dynamicThreadPoolTaskExecutor.setCorePoolSize(corePoolSize);
|
|
@@ -63,7 +63,7 @@ public class DynamicMyThreadPool extends ThreadPoolTaskExecutor {
|
|
}
|
|
}
|
|
|
|
|
|
public void shutDown() {
|
|
public void shutDown() {
|
|
- synchronized (this.poolSizeMonitor) {
|
|
|
|
|
|
+ synchronized (poolSizeMonitor) {
|
|
DynamicMyThreadPool executor = this.getExecutor();
|
|
DynamicMyThreadPool executor = this.getExecutor();
|
|
executor.shutdown();
|
|
executor.shutdown();
|
|
if (executor.getThreadPoolExecutor().isShutdown()) {
|
|
if (executor.getThreadPoolExecutor().isShutdown()) {
|
|
@@ -97,7 +97,7 @@ public class DynamicMyThreadPool extends ThreadPoolTaskExecutor {
|
|
}
|
|
}
|
|
|
|
|
|
public Executor reLoad() {
|
|
public Executor reLoad() {
|
|
- synchronized (this.poolSizeMonitor) {
|
|
|
|
|
|
+ synchronized (poolSizeMonitor) {
|
|
this.dynamicThreadPoolTaskExecutor = null;
|
|
this.dynamicThreadPoolTaskExecutor = null;
|
|
log.info(">>>>>>>>>>>> 准备重新创建线程池 >>>>>>>>>>>>", this.getThreadNamePrefix());
|
|
log.info(">>>>>>>>>>>> 准备重新创建线程池 >>>>>>>>>>>>", this.getThreadNamePrefix());
|
|
return this.createThreadPool();
|
|
return this.createThreadPool();
|