[jboss-dev-forums] [JBoss AS Development] - Graceful Shutdown
ALRubinger
do-not-reply at jboss.com
Mon Nov 23 13:44:17 EST 2009
@see https://jira.jboss.org/jira/browse/JBBOOT-116
The objective discussed at the AS Design Meeting was to allow for all current requests and sessions to continue operating as expected while disallowing new ones. Only after a subsystem has completed all of its pending work may it be brought out of service.
Initially we'd tossed around the idea of a registration API alongside jboss-bootstrap which would allow components to opt-in to receive a 2-phase event, and handle accordingly. But this doesn't handle dependencies between subsystems:
Web request > Servlet > SLSB > JCA > MDB
This means that web must stop accepting requests before EJB3 does, else the request will break during the invocation. For this Brian, Jesper and I have discussed leveraging the MC dependency chain to do this a bit more intelligently.
The solution on the table is to add a "pre-stop" phase. Subsystems may handle @PreStop lifecycle events, and MC will guarantee that these are fired in order (assuming the dependencies are explicitly and correctly declared between components).
So for instance:
@PreStop
| public void gracefulShutdownPrepare(){
| // Shut down listener for new requests
| listener.stop();
|
| // Block until all current sessions have ended or are expired
| while(hasCurrentSessions()){
| Thread.sleep(1000);
| }
|
| // OK, go on to the next dep in the chain
| return;
| }
S,
ALR
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267115#4267115
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267115
More information about the jboss-dev-forums
mailing list