6 Replies Latest reply on Sep 7, 2007 10:00 AM by adrian.brock

    Deployer Changes for AOP

      Related to this thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058730#4058730

      The AOPDeployer for JBoss5 needs updating and aop re-releasing.
      See jboss-head/system/src/main/org/jboss/aop/temp/AOPDeployer.java
      for an example of what this should look like.

      Once that is done, the config in server/src/etc/conf/default/bootstrap-beans.xml
      can be reverted:

       <!-- AOP deployment -->
       <bean name="AspectDeployer" class="org.jboss.aop.deployers.temp.AspectDeployer">
      


      While I was there I made some other changes, but there are still more that need doing
      (in the error handling strategy).

      The changes I made are:
      1) You now inject the AspectManager.

      2) I fixed the undeployment error handling such that it tries to complete
      all undeployment, previously it had this bad pattern:

      for (Object x : deployed)
      {
       try
       {
       undeploy(x);
       }
       catch (Throwable t)
       {
       // Oops, we stop undeploying on the first error,
       // meaning not everything gets undeployed!
       throw new RuntimeException(t);
       }
      }
      


      I've changed it to a WARN.
      It should also really be undeploying in the reverse order of what gets deployed.

      Similarly I fixed this stupid code - partly for the same reason, but
      also partly because there is no possible reason why closing is an error
      that is interesting.
      IMHO have close() throw an exception is just stupid anyway. :-)
      try
      {
       stream.close();
      }
      catch (IOException e)
      {
       throw new RuntimeException(e);
      }
      


      The other thing that needs doing is similar to the undeploy problem
      but for deployment.
      If you are deploying things in a loop then you need to unwind what you've already done,
      e.g. this code from inside the deployment infrastructure:
       int i = 0;
       try
       {
       while (i < theDeployers.size())
       {
       Deployer deployer = theDeployers.get(i);
       doInstall(deployer, context, doComponents);
       ++i;
       }
       }
       catch (Throwable t)
       {
       context.setState(DeploymentState.ERROR);
       context.setProblem(t);
      
       // UNWIND THINGS ALREADY DONE
       for (int j = i-1; j >= 0; --j)
       {
       Deployer deployer = theDeployers.get(j);
       doUninstall(deployer, context, true);
       }
       throw t;
       }
       }