Skip to main content

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

On 19/07/2011 03:55, Jan Bartel wrote:
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.

OK, I have this anyway. However, the server is only running the one
webapp, and users have to log in. I have a SessionListener that monitors
the number of logged in users, so what I want is to restart as soon as
the last user logs out (I don't want to kill any existing sessions).

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.

Restarting the webapp will reload the class files, yes?

The sequence would be something like:

+ call close() on all of the connectors
+ call setShutdown(true) on the WebAppContext

I don't see setShutdown from JMX...

+ wait for a little while for existing requests to drain out

Presumably not needed if no-one is logged in?

+ call stop() on the WebAppContext
+ call start() on the WebAppContext
+ call open() on the connectors

So, I'll try this from inside the session listener and see what
happens...

Many thanks,

------------------------------------------------------------------------
 John English | My old University of Brighton home page is still here:
              | http://www.it.brighton.ac.uk/staff/je
------------------------------------------------------------------------


Back to the top