jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.87k stars 1.91k forks source link

Question about org.eclipse.jetty.server.LowResourceMonitor#setMonitorThreads #12537

Open lijinliangyihao opened 1 week ago

lijinliangyihao commented 1 week ago

Jetty Version latest Jetty Environment

Java Version

Question

At jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/LowResourceMonitor.java#setMonitorThreads(boolean monitorThreads). Here's the code, if the param monitorThreads is false then nothing will happen.

public void setMonitorThreads(boolean monitorThreads)
    {
        if (monitorThreads)
            // already configured?
            if (!getMonitorThreads())
                addLowResourceCheck(new ConnectorsThreadPoolLowResourceCheck());
            else
                getBeans(ConnectorsThreadPoolLowResourceCheck.class).forEach(this::removeBean);
    }

Should it be

public void setMonitorThreads(boolean monitorThreads)
    {
        if (monitorThreads) {
            // already configured?
            if (!getMonitorThreads())
                addLowResourceCheck(new ConnectorsThreadPoolLowResourceCheck());
        } else
            getBeans(ConnectorsThreadPoolLowResourceCheck.class).forEach(this::removeBean);
    }

?