Brian Stansberry wrote:
Something to think about is how all this can apply to a "graceful undeploy" notion. A graceful undeploy is just a more limited scope for the above. So, possibly a service that is part of a deployment could have a "GracefulUndeployService" injected, with which it could register a callback. The trick would be having that GracefulUndeployService have the correct scope; i.e. it's not an AS-wide singleton like GracefulShutdownService.
Is this really needed? Couldn't the services that make up a deployment could just use the same GracefulShutdownService? E.g you could have a DeploymentSessionManager which owns all sessions associated with a deployment, or has the ability to clean them up.