How do I Manage Jetty Thread Pool with Rest DSL

Solution Verified - Updated -

Issue

It does not appear to be possible to effectively manage Jetty thread pool sizes when using REST DSL in Camel.

Trying to set the thread pool minimum and maximum sizes via endpointProperty values as below appears to be ignored:

        <restConfiguration bindingMode="json" component="jetty" host="{{server.host}}" port="{{server.port}}" scheme="http">   
            <endpointProperty key="servletName" value="RestServlet"/>
            <endpointProperty key="minThreads" value="20"/>
            <endpointProperty key="maxThreads" value="20"/>
            <dataFormatProperty key="prettyPrint" value="true"/>
            <dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_UNKNOWN_PROPERTIES,ADJUST_DATES_TO_CONTEXT_TIME_ZONE"/>
            <dataFormatProperty key="json.in.enableFeatures" value="FAIL_ON_NUMBERS_FOR_ENUMS,USE_BIG_DECIMAL_FOR_FLOATS"/>
        </restConfiguration>

Setting the values explicitly in a "jetty" bean seems to work a little better:

    <camelContext id="restTestJetty" trace="false" xmlns="http://camel.apache.org/schema/blueprint">  

        <restConfiguration bindingMode="json" component="jetty" host="{{server.host}}" port="{{server.port}}" scheme="http">   
            <endpointProperty key="servletName" value="RestServlet"/>
            <dataFormatProperty key="prettyPrint" value="true"/>
            <dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_UNKNOWN_PROPERTIES,ADJUST_DATES_TO_CONTEXT_TIME_ZONE"/>
            <dataFormatProperty key="json.in.enableFeatures" value="FAIL_ON_NUMBERS_FOR_ENUMS,USE_BIG_DECIMAL_FOR_FLOATS"/>
        </restConfiguration>

        <rest consumes="application/json" path="/OutputService" produces="application/json">
            <get
                outType="java.lang.String" uri="/{type}/{ip}">
                <description>Lookup a location</description>
                <to uri="bean:inputService?method=getLoc(${header.type}, ${header.ip})"/>
            </get>
        </rest>

        <rest consumes="application/json" path="/InputService" produces="application/json">
            <put
                outType="java.lang.String" uri="/{type}/{ip}/{loc}">
                <description>Store a location</description>
                <to uri="bean:inputService?method=setLoc(${header.type}, ${header.ip}, ${header.loc})"/>
            </put>
        </rest>
    </camelContext>

however, restarting the component / bundle results in thread pool leakage and we can see the number of threads increasing by the thread pool minimum size with each restart.

Environment

Red Hat Fuse 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content