Skip to content

What does the defaultEventExecutorGroup in NettyClientBootstrap do? #6132

@PleaseGiveMeTheCoke

Description

@PleaseGiveMeTheCoke

defaultEventExecutorGroup在NettyClientBootstrap的start方法中被开启。

    public void start() {
        if (this.defaultEventExecutorGroup == null) {
            this.defaultEventExecutorGroup = new DefaultEventExecutorGroup(nettyClientConfig.getClientWorkerThreads(),
                new NamedThreadFactory(getThreadPrefix(nettyClientConfig.getClientWorkerThreadPrefix()),
                    nettyClientConfig.getClientWorkerThreads()));
        }
        // ......
    }

根据它的命名NettyClientWorkerThread,它是一个worker线程组,但是我并没有发现使用到该线程组的地方。

    String DEFAULT_SELECTOR_THREAD_PREFIX = "NettyClientSelector";
    String DEFAULT_WORKER_THREAD_PREFIX = "NettyClientWorkerThread";

这是不是意味着开启了一个占用系统资源但没什么用处的线程组?


defaultEventExecutorGroup is enabled in the startup method of NettyClientBootstrap.

    public void start() {
        if (this.defaultEventExecutorGroup == null) {
            this.defaultEventExecutorGroup = new DefaultEventExecutorGroup(nettyClientConfig.getClientWorkerThreads(),
                new NamedThreadFactory(getThreadPrefix(nettyClientConfig.getClientWorkerThreadPrefix()),
                    nettyClientConfig.getClientWorkerThreads()));
        }
        // ......
    }

According to its naming NettyClientWorkerThread, it is a Worker thread group, but I didn't find any use for that thread group.

    String DEFAULT_SELECTOR_THREAD_PREFIX = "NettyClientSelector";
    String DEFAULT_WORKER_THREAD_PREFIX = "NettyClientWorkerThread";

Does this mean that a thread group is opened that takes up system resources but is of little use?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions