super.setState(state);
if (state == ProcessInstanceImpl.STATE_COMPLETED) {
// deactivate all node instances of this process instance
while (!nodeInstances.isEmpty()) {
RuleFlowNodeInstance nodeInstance = (RuleFlowNodeInstance) nodeInstances.get(0);
nodeInstance.cancel();
}
workingMemory.removeEventListener((AgendaEventListener) this);
workingMemory.removeEventListener((RuleFlowEventListener) this);
((EventSupport) this.workingMemory).getRuleFlowEventSupport()
.fireRuleFlowProcessCompleted(this, this.workingMemory);