[jboss-dev-forums] [JBoss AS7 Development] - Re: Deployer chain cleanup
David Lloyd
do-not-reply at jboss.com
Wed Nov 10 17:41:55 EST 2010
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&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20101110/dc49677f/attachment.html
More information about the jboss-dev-forums
mailing list