cancel
Showing results for 
Search instead for 
Did you mean: 

Setting deployers on the ProcessEngineConfiguration

iravanchi
Champ in-the-making
Champ in-the-making
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.
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

Can you tell a little bit more about what you want to do with the deployers list.
The pre and post deployers are the most useful if you want to add new functionality.
So why do you want to override the deployers?

Best regards,

iravanchi
Champ in-the-making
Champ in-the-making
Hi,

I'm not having any problems here, and I'm using the pre-deployers list.
I'm using a variant of BPMN notation for what I need, so I need my own deployer.

This is something that I came up with when looking at the code, and thought that either the init method should not override the deployers list, or the setter for deployers should be removed to avoid confusion.

-Hamed