[jboss-user] [JBoss Microcontainer] - AbstractRealDeployerWithInput fails to call undeploy() on DeploymentVisitor, for failed deployments

jaikiran pai do-not-reply at jboss.com
Fri Jul 30 12:14:41 EDT 2010


jaikiran pai [http://community.jboss.org/people/jaikiran] replied to the discussion

"AbstractRealDeployerWithInput fails to call undeploy() on DeploymentVisitor, for failed deployments"

To view the discussion, visit: http://community.jboss.org/message/555224#555224

--------------------------------------------------------------
> Ales Justin wrote:
> 
> > That would effectively mean, that *every* implementation of the org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor interface, has to have the following code in their deploy:
> > 
> No, why?
> 
Because, in it's current form, if some *unexpected* exception occurs then the undeploy will never get called with that try{}catch(Throwable t) block.


> Ales Justin wrote:
> 
> 
> See existing impl, none has that.
And all those will fail (i.e. their undeploy() will not get called) if they happen to run into runtime exceptions in their deploy.


> Ales Justin wrote:
> 
> Either they don't have anything, since the deploy action is very simple

Doesn't matter if it's simple or not  :)  Even if it's a couple of lines code, it can end up throwing a runtime.

> Ales Justin wrote:
> 
>  (almost atomic  :) ),
That's just an assumption  :) 

> Ales Justin wrote:
> 
>  The idea is that the visitor's deploy is very simple, or you missused the deployer.

Consider this again, in my visitor's deploy:

void deploy(DeploymentUnit unit, T deployment) throws DeploymentException
{
    Ejb3Registry.register(...);
 
    callThirdPartyCodeWhichRunsIntoNullPointerException();
}  


I don't see any misuse here. So when I call the  callThirdPartyCodeWhichRunsIntoNullPointerException(), which as the name suggests will run into a NPE (for some reason), I have no way of unregistering from Ejb3Registry, unless I wrap all this in a try{}catch(Throwable t) block or at the very least in a try{}catch(RuntimeException re) block.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/555224#555224]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100730/56ebc73b/attachment.html 


More information about the jboss-user mailing list