AnsweredAssumed Answered

Setting deployers on the ProcessEngineConfiguration

Question asked by iravanchi on Jul 19, 2011
Latest reply on Jul 19, 2011 by iravanchi
Hi,

If we set the "deployers" property on the engine configuration, and don't set the "deploymentCache", the deployers are ignored.
Here's the code of "initDeployers" method in ProcessEngineConfigurationImpl:

   protected void initDeployers() {
      if (this.deployers == null) {
         this.deployers = new ArrayList<Deployer>();
         if (customPreDeployers != null) {
            this.deployers.addAll(customPreDeployers);
         }
         this.deployers.addAll(getDefaultDeployers());
         if (customPostDeployers != null) {
            this.deployers.addAll(customPostDeployers);
         }
      }
      if (deploymentCache == null) {
         List<Deployer> deployers = new ArrayList<Deployer>();
         if (customPreDeployers != null) {
            deployers.addAll(customPreDeployers);
         }
         deployers.addAll(getDefaultDeployers());
         if (customPostDeployers != null) {
            deployers.addAll(customPostDeployers);
         }

         deploymentCache = new DeploymentCache();
         deploymentCache.setDeployers(deployers);
      }
   }

I think the construction of deployers should be omitted from the second "if" block, so the code being like this:

   protected void initDeployers() {
      if (this.deployers == null) {
         this.deployers = new ArrayList<Deployer>();
         if (customPreDeployers != null) {
            this.deployers.addAll(customPreDeployers);
         }
         this.deployers.addAll(getDefaultDeployers());
         if (customPostDeployers != null) {
            this.deployers.addAll(customPostDeployers);
         }
      }
      if (deploymentCache == null) {
         deploymentCache = new DeploymentCache();
         deploymentCache.setDeployers(deployers);
      }
   }

If the user is supposed to set the pre- and post- deployers only, and not touch the original deployers list, then the setter method for the deployers list should be removed. Either one of the above, or I'm getting something wrong.

Outcomes