Commit d305f1e6 by huangfusuper

Merge remote-tracking branch 'origin/developer' into developer

# Conflicts:
#	byit-myth-core/myth-admin-core/src/main/java/com/byit/factory/DaemonScanThreadRunHelperRedisLock.java
parents 697dece3 fca591cd
package com.byit.factory; package com.byit.factory;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
import com.byit.util.ThreadPoolUtil;
import com.byit.util.lock.RedissLockUtil; import com.byit.util.lock.RedissLockUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -8,6 +9,7 @@ import java.util.HashSet; ...@@ -8,6 +9,7 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -48,6 +50,12 @@ public abstract class BaseDaemonScanThreadRunHelper implements DaemonScanThreadR ...@@ -48,6 +50,12 @@ public abstract class BaseDaemonScanThreadRunHelper implements DaemonScanThreadR
public static final Set<String> LOCK_NAMES = new HashSet<>(8); public static final Set<String> LOCK_NAMES = new HashSet<>(8);
/** /**
* 扫描线程数量
*/
public static ThreadPoolExecutor SCAN_WORLD_THREAD = ThreadPoolUtil.createFixedLengthThreadPoolExecutor("scan flow stream thread",THREAD_RUN_OPT.entrySet().size());
/**
* 线程添加 将线程扫描器添加进线程管理池 * 线程添加 将线程扫描器添加进线程管理池
* @param threadRunHelper 扫描器 * @param threadRunHelper 扫描器
*/ */
...@@ -63,25 +71,27 @@ public abstract class BaseDaemonScanThreadRunHelper implements DaemonScanThreadR ...@@ -63,25 +71,27 @@ public abstract class BaseDaemonScanThreadRunHelper implements DaemonScanThreadR
*/ */
@Override @Override
public void logoutThreadGroup() { public void logoutThreadGroup() {
THREAD_GROUP_STOP = true; // THREAD_GROUP_STOP = true;
Set<Map.Entry<String, Thread>> threadExamples = THREADS_MAP.entrySet(); // Set<Map.Entry<String, Thread>> threadExamples = THREADS_MAP.entrySet();
threadExamples.forEach(threadExample ->{ // threadExamples.forEach(threadExample ->{
log.warn("------------开始注销线程{}------------",threadExample); // log.warn("------------开始注销线程{}------------",threadExample);
String threadName = threadExample.getKey(); // String threadName = threadExample.getKey();
Thread thread = threadExample.getValue(); // Thread thread = threadExample.getValue();
dateAligned(CLOSE_WAIT_TIME,threadName); // dateAligned(CLOSE_WAIT_TIME,threadName);
//判断线程是否处于终止状态 // //判断线程是否处于终止状态
if(thread.getState() != Thread.State.TERMINATED){ // if(thread.getState() != Thread.State.TERMINATED){
thread.interrupt(); // thread.interrupt();
//
// try {
// thread.join();
// } catch (InterruptedException e) {
// e.printStackTrace( );
// }
// }
// log.warn("--------{}线程被注销---------",threadName);
// });
try { SCAN_WORLD_THREAD.shutdown();
thread.join();
} catch (InterruptedException e) {
e.printStackTrace( );
}
}
log.warn("--------{}线程被注销---------",threadName);
});
LOCK_NAMES.forEach(lockName ->{ LOCK_NAMES.forEach(lockName ->{
log.warn("--------{}锁消除---------",lockName); log.warn("--------{}锁消除---------",lockName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment