Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetty nonblocking by default?

Please tell me, Is Jetty non-blocking web server by default or not?

For example, this code below runs Jetty as 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 you!!!

like image 374
Edward83 Avatar asked Oct 16 '25 00:10

Edward83


1 Answers

It depends on which version of Jetty you're using.

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

If you really care about the behaviour, you're better off configuring the connector yourself, rather than relying on that convenience constructor.

like image 74
Tim Avatar answered Oct 18 '25 13:10

Tim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!