[jboss-dev-forums] [JBoss AS Development] - Re: Graceful Shutdown
bstansberry@jboss.com
do-not-reply at jboss.com
Tue Nov 24 10:42:55 EST 2009
"emuckenhuber" wrote : Hmm graceful shutdown should not be part of the MC bean lifecycle, as it would then always shutdown in a graceful manner. This should be an optional way to shutdown AS - triggered with a different signal or management action.
| Additionally with the graceful shutdown there will most likely be a timeout which then is going just stop AS. This does not seem to fit very well with MC lifecycle actions, since we would basically need to interrupt a action during a state transition (pre_stop -> stop).
With the acceptor concept we should be able to deal with these issues even though we're essentially using the MC lifecycle.
The acceptors can all be registered with a central management bean that can set a property as to how long they should wait to return from stop(). -1, don't do anything, just return, 0 wait as long as it takes, > 0, wait that long. The default is -1 or something configurable at the server level. The management console sets to something else if a graceful shutdown is invoked.
The acceptors should have a thread pool injected so they use a pool thread to actually perform the graceful shutdown work (with a Future). So the thread calling in from the MC won't have to be interrupted in some arbitrary code; it's just blocking in a future.
It's the responsibility of the acceptor impls (or more likely some element of the container they're associated with) to ensure that if a graceful shutdown is requested and is still in progress they can still cleanly perform their normal stop() processing. I don't think this should be hard. As I see it, the graceful shutdown task would be to:
1) If possible, signal load balancing mechanism that this node shouldn't receive new sessions, or new requests if requests are the relevant unit of work.
.. some details skipped...
2) Wait for existing work to complete.
3) Close a gate such that requests for new work raise an exception, generate an HTTP 503 etc.
It shouldn't be hard to ensure that a normal stop() can proceed even if the above isn't complete.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267328#4267328
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267328
More information about the jboss-dev-forums
mailing list