mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-14 20:17:51 +00:00
perf[thread]: 优化当前线程的线程组
This commit is contained in:
1 parent
5c268e8dcf
commit
fed22442e7
5 files changed
+15
-8
No files matched your search
@@ -88,8 +88,7 @@ public class ZookeeperRegistry implements IRegistry {
|
||||
|
||||
// config-p1-t1 = config-pool-1-thread-1
|
||||
ConfigThreadFactory() {
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
|
||||
this.group = ThreadUtils.currentThreadGroup();
|
||||
namePrefix = "config-p" + poolNumber.getAndIncrement() + "-t";
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.zfoo.protocol.util.AssertionUtils;
|
||||
import com.zfoo.protocol.util.StringUtils;
|
||||
import com.zfoo.scheduler.manager.SchedulerBus;
|
||||
import com.zfoo.util.SafeRunnable;
|
||||
import com.zfoo.util.ThreadUtils;
|
||||
import com.zfoo.util.math.RandomUtils;
|
||||
import io.netty.util.concurrent.FastThreadLocalThread;
|
||||
import org.slf4j.Logger;
|
||||
@@ -78,8 +79,7 @@ public final class TaskBus {
|
||||
private final ThreadGroup group;
|
||||
|
||||
public TaskThreadFactory(int poolNumber) {
|
||||
var s = System.getSecurityManager();
|
||||
group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
|
||||
this.group = ThreadUtils.currentThreadGroup();
|
||||
this.poolNumber = poolNumber;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user