JBoss Community

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

reply from jaikiran pai in JBoss Microcontainer - View the full discussion

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


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

Start a new discussion in JBoss Microcontainer at Community