[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MainDeployerImpl.deploy and checkComplete

adrian@jboss.org do-not-reply at jboss.com
Fri Nov 16 10:24:57 EST 2007


"alesj" wrote : With the full impl of JBMICROCONT-187 (which is done :-)), this needs changing in MainDeployerImpl.deploy:
  | 
  |   |    public void deploy(Deployment deployment) throws DeploymentException
  |   |    {
  |   |       addDeployment(deployment);
  |   |       process();
  |   |       // FIXME don't check contexts
  |   |       checkComplete(deployment);
  |   |    }
  |   | 
  | 
  | Since it's completely legit to have not yet fully installed contexts - depending beans, OSGi deployments, ...
  | 
  | Adding 'checkStructureComplete(Deployment)' in DeployerClient --> only checking if deployment is in error or missing deployer?

No that's not the purpose of the single deployment api.
It is a short hand way of doing:

  | deployerClient.addDeployment(deployment);
  | deployerClient.process();
  | deployerClient.checkComplete();
  | 

Except in a thread safe way. In fact the code should be:

  |    public void deploy(Deployment deployment) throws DeploymentException
  |    {
  |       addDeployment(deployment);
  |       process(deployment);
  |       try
  |       {
  |          checkComplete(deployment);
  |       }
  |       catch (DeploymentException e)
  |       {
  |           // Didn't work, roll it back
  |          removeDeployment(deployment);
  |          process(deployment);
  |       }
  |    }
  | 

Where process(deployment) only processes the passed deployment,
not other deployments that may have been added on other threads.

But more importantly, it should really be an atomic operation.
i.e. the deployment is either fully working or it is not deployed at all.

If you want to add a less strict convience api that is fine,
but it is a 5% use case not the normal 95% use case of this method.
It's not related to this issue.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105514#4105514

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105514



More information about the jboss-dev-forums mailing list