Skip to content

Commit

Permalink
Fix deployment cache issue for dmn engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsrademakers committed Apr 3, 2024
1 parent 85183ef commit 8a3cded
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) {

// Add to deployment for further usage
deployment.addDeployedArtifact(decisionEntity);
deployment.addDecisionCacheEntry(decisionEntity.getId(), cacheEntry);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public DecisionCacheEntry resolveDecision(DmnDecision decision) {

deployment.setNew(false);
deploy(deployment, null);
cachedDecision = decisionCache.get(decisionId);
cachedDecision = deployment.getDecisionCacheEntry(decisionId);

if (cachedDecision == null) {
throw new FlowableException("deployment '" + deploymentId + "' didn't put decision '" + decisionId + "' in the cache");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.flowable.common.engine.api.repository.EngineResource;
import org.flowable.common.engine.impl.persistence.entity.Entity;
import org.flowable.dmn.api.DmnDeployment;
import org.flowable.dmn.engine.impl.persistence.deploy.DecisionCacheEntry;

/**
* @author Tijs Rademakers
Expand All @@ -32,6 +33,10 @@ public interface DmnDeploymentEntity extends DmnDeployment, Entity {
void addDeployedArtifact(Object deployedArtifact);

<T> List<T> getDeployedArtifacts(Class<T> clazz);

void addDecisionCacheEntry(String decisionDefinitionId, DecisionCacheEntry decisionCacheEntry);

DecisionCacheEntry getDecisionCacheEntry(String decisionDefinitionId);

void setName(String name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.flowable.common.engine.api.repository.EngineResource;
import org.flowable.dmn.engine.DmnEngineConfiguration;
import org.flowable.dmn.engine.impl.persistence.deploy.DecisionCacheEntry;

/**
* @author Tijs Rademakers
Expand All @@ -43,6 +44,7 @@ public class DmnDeploymentEntityImpl extends AbstractDmnEngineNoRevisionEntity i
* Will only be used during actual deployment to pass deployed artifacts (eg decision tables). Will be null otherwise.
*/
protected Map<Class<?>, List<Object>> deployedArtifacts;
protected Map<String, DecisionCacheEntry> decisionDefinitionCache = new HashMap<>();

public DmnDeploymentEntityImpl() {

Expand Down Expand Up @@ -98,6 +100,16 @@ public <T> List<T> getDeployedArtifacts(Class<T> clazz) {
}
return null;
}

@Override
public void addDecisionCacheEntry(String decisionDefinitionId, DecisionCacheEntry decisionCacheEntry) {
decisionDefinitionCache.put(decisionDefinitionId, decisionCacheEntry);
}

@Override
public DecisionCacheEntry getDecisionCacheEntry(String decisionDefinitionId) {
return decisionDefinitionCache.get(decisionDefinitionId);
}

// getters and setters ////////////////////////////////////////////////////////

Expand Down

0 comments on commit 8a3cded

Please sign in to comment.