Skip to content

Commit

Permalink
[Fix apache#3390] Do not create container intance, search it
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Mar 8, 2024
1 parent f04c2a3 commit 0c72d9f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jbpm.workflow.core.node.AsyncEventNode;
import org.kie.api.definition.process.Node;
import org.kie.api.definition.process.NodeContainer;
import org.kie.kogito.internal.process.runtime.KogitoNodeInstance;
import org.kie.kogito.internal.process.runtime.KogitoNodeInstanceContainer;

import static org.jbpm.ruleflow.core.Metadata.CUSTOM_ASYNC;
Expand Down Expand Up @@ -64,7 +65,13 @@ default NodeInstance getByNodeDefinitionId(final String nodeDefinitionId, NodeCo

if (nodeDefinitionId.equals(node.getMetaData().get(UNIQUE_ID))) {
if (nodeContainer instanceof Node) {
return ((NodeInstanceContainer) getNodeInstance((Node) nodeContainer)).getNodeInstance(node);
Collection<KogitoNodeInstance> nodeInstances = getKogitoNodeInstances(ni -> ni.getNode().getId() == (((Node) nodeContainer).getId()), true);
if (nodeInstances.isEmpty()) {
return getNodeInstance(node);
} else {
return ((NodeInstanceContainer) nodeInstances.iterator().next()).getNodeInstance(node);
}

} else {
return getNodeInstance(node);
}
Expand Down

0 comments on commit 0c72d9f

Please sign in to comment.