Currently Jetty calculates acceptor and selector count as a fraction of processor count (core/8 and core/2 respectively) and will maximize them as 4. That means 4 acceptor and 4 select in a 32+ core machine for each ServerConnector. In Server.doStart jetty will check if maxThreadPoolSize is large enough to store a request thread and all acceptors and selectors thread for each connector together.
Currently in tests thread pool max size fixed as 16. In GatewayServer.start if gateway port mapping is enabled it will initialize two connectors in jetty which on a 32+ core machine will create 4+4 acceptor and 4+4 selector. With the one extra request thread it will exceed the 16 thread pool limit and org.apache.hadoop.gateway.GatewayPortMappingFuncTest will throw the following exception:
This is only a unit test problem since the default value for thread pool size in GatewayConfigImpl is 254.
Probably it would be a better method to calculate thread pool count from core count or max thread count in tests or just use the default value from GatewayConfigImpl.