Skip to content

org.eclipse.jetty.server.LowResourceMonitor#setMonitorThreads seems not right #12537

@lijinliangyihao

Description

@lijinliangyihao

Jetty Version
latest
Jetty Environment

Java Version

Issue

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);
    }

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions