Pregunta

How can I set or increase the connection limit or the max. pool size of worker threads in a grizzly HttpServer which i created with:

HttpServer server = HttpServer.createSimpleServer(host, port);
¿Fue útil?

Solución

There is no configuration for limiting the number of concurrent connections. In order to tweak the kernel or worker thread pools, you'll need to get a hold of the transport.

HttpServer server = ...
// The default network listener is named grizzly when 
// creating a server via the factory method
NetworkListener l = server.getNetworkListener("grizzly");
TCPNIOTransport transport = l.getTransport();

// You can make changes to the kernel thread pool
// by calling transport.getKernelThreadPoolConfig().
// Changes to the worker thread pool via
// transport.getWorkerThreadPoolConfig().

Java docs for the above can be found here

If you do need to be able to limit the number of concurrent connections, I'd recommend following up on the Grizzly user's mailing list

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top