0
votes

I have a web app on a Jetty server that uses external services (loads data from another server, connects to a an external socket to receive data etc) and websockets to deliver events and onther data to clients. What I need is to switch from one production version to another (let's say my app has FirstApp.xml context config file and 2 wars: AppVer1.war and AppVer2.war) without downtime (even for 1 second), and without closing sockets connections and websockets for clients. Is this possible with jetty?

Obs. Loading data from other server and creating a socket connection is made in a servlet class, so maybe there are other type of components I should use?

EDIT: I'm using Jetty 9.3.5

1
Which version of jetty are you using?Eric
Hi, I'm using Jetty 9.3.5 (i've edited my post).Andrei F

1 Answers

0
votes

As soon as a request comes in, a HttpServletRequest and routing to a specific ServletContext (WebApp) occurs.

This is true for normal HTTP requests, and also upgraded WebSocket requests.

It is not possible to swap out the webapp during an active request (likely true for all Servlet containers). The ServletContext of AppVer1 would have to undergo its lifecycle and destroy all of its filters/servlets and whatnot, rendering the ServletContext invalid for the request, thus closing the active requests.

Perhaps you should change your WebApp architecture so that you have a simple facade in front that handles the requests and request routing, but the meat of the application logic is done elsewhere, and not part of the WebApp. This could allow you the control you are looking for.