Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Restarting webapp programmatically?

John,

If you have called Server.setGracefulShutdown(int ms) the shutdown should not cause much
disruptions to users, as it will stop the connectors accepting any new connections and then
wait the designated number of ms for existing requests to drain out of the context.

Alternatively, you might not have to stop the whole server, you should just be able to
stop the webapp. You might need to stop the connectors too.

The sequence would be something like:

+ call close() on all of the connectors
+ call setShutdown(true) on the WebAppContext
+ wait for a little while for existing requests to drain out
+ call stop() on the WebAppContext
+ call start() on the WebAppContext
+ call open() on the connectors

If you don't have direct references to all of these objects you can access them via jmx.

Jan

On 19 July 2011 00:54, John English <john.foreign@xxxxxxxxx> wrote:
I have a webapp running on Jetty 7, and I can update it by copying new
class files to WEB-INF/classes and then restarting the server. This can
cause problems if any users are connected at the time. What I'd like to
be able to do is set a flag to ask the webapp to restart and use a SessionListener to restart the webapp when the last user logs out.

The question is, is there any way to restart either a webapp or Jetty
itself from inside a SessionListener like this?

TIA,

------------------------------------------------------------------------
 John English | My old University of Brighton home page is still here:
             | http://www.it.brighton.ac.uk/staff/je
------------------------------------------------------------------------
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top