is Jetty non-blocking web server by default?
For example, the following code runs 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 you! ! !
> In Jetty 6, the “Server(int port)” constructor will open a blocking connector on the port.
>In Jetty 7, the “Server(int port)” constructor will open a non-blocking connector on the port Connector.
If you really care about this behavior, you’d better configure the connector yourself instead of relying on the convenience constructor.
Please tell me,
is Jetty non-blocking web server by default?
For example, the following code runs 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 you! ! !
It depends on the Jetty version you are using.
>In Jetty 6, “Server(int port)” The 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 If you really care about this behavior, you’d better configure the connector yourself instead of relying on the convenience constructor.