Is Jetty non-blocking by default?

Please tell me Is the gateway a non-blocking web server by default or not?

For example, does the code below start Jetty as a non-blocking web server?

Server server = new Server(8080);

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

context.setContextPath("/");

server.setHandler(context);

context.addServlet(new ServletHolder(new MyServlet()),"/*");

server.start();

server.join();

Thank!!!

+3
source share
1 answer

It depends on which version of Jetty you are using.

  • In Jetty 6, the "Server (int port)" constructor will open a blocking connector on this port.
  • In Jetty 7, the "Server (int port)" constructor opens a non-blocking connector on this port.

If you really care about behavior, you'd better configure the connector itself, rather than relying on this convenience constructor.

+7
source

Source: https://habr.com/ru/post/1774335/


All Articles