users@jersey.java.net

[Jersey] Re: It's very hard to increase the number of worker threads in Jersey-Grizzly module.

From: <mbuesch_at_gmail.com>
Date: Thu, 31 May 2012 09:18:25 +0000 (GMT)

That doesn't work, after the Server is started:

I checked with this example:

        int testPort = AvailablePortFinder.getNextAvailable(1024);
        HttpServer server =
GrizzlyServerFactory.createHttpServer("http://localhost:" + testPort,
new DefaultResourceConfig(Resource.class));

// create the thread pool configuration
        ThreadPoolConfig config = createThreadConfig(poolName);

        // assign the thread pool
        NetworkListener listener =
server.getListeners().iterator().next();
        log.info("NetworListener Name " + listener.getName());
        final TCPNIOTransport tcpnioTransport =
listener.getTransport();
        tcpnioTransport.setWorkerThreadPoolConfig(config);
        final ThreadPoolConfig real =
tcpnioTransport.getWorkerThreadPoolConfig();
        if (config.getCorePoolSize() != real.getCorePoolSize())
log.info("CorePoolSize is not set. Should be :" +
config.getCorePoolSize() + " but is :" + real.getCorePoolSize());
        if (config.getMaxPoolSize() != real.getMaxPoolSize())
log.info("MaxPoolSize is not set. Should be :" +
config.getMaxPoolSize() + " but is :" + real.getMaxPoolSize());