David Lloyd [
http://community.jboss.org/people/david.lloyd%40jboss.com] created the
discussion
"Re: Deployer chain cleanup"
To view the discussion, visit:
http://community.jboss.org/message/570623#570623
--------------------------------------------------------------
In an ideal world we'd be able to use an interceptor-chain kind of pattern where each
processor calls invokeNext() or whatever, and any error cleanup could be done in a finally
block. However the grim reality is that we could face stack exhaustion if we had a truly
large number of extensions involved. I think the next-best option is what you suggest: a
cleanup() method which is called if a later processor fails.
So to restate:
1. Add a cleanup() method to DeploymentUnitProcessor
2. Each implementation of DUP should handle failure cleanly, so processDeployment is
essentially atomic: either everything gets done or nothing (no partial state when an
exception is thrown).
3. Then the implementation of cleanup() can perform a full cleanup safely, because it will
only ever be called if processDeployment() had completed successfully *and* a later
processDeployment() failed.
4. This implies that if a given processDeployment() fails, its cleanup() is *not* called,
but the cleanup() methods on all the DUPs before the one that failed *are* called.
Make sense?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/570623#570623]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]