@ -121,11 +121,17 @@ public class WorkflowExecuteThreadPool extends ThreadPoolTaskExecutor {
@Override
@Override
public void onSuccess ( Object result ) {
public void onSuccess ( Object result ) {
if ( workflowExecuteThread . workFlowFinish ( ) ) {
// if an exception occurs, first, the error message cannot be printed in the log;
stateWheelExecuteThread . removeProcess4TimeoutCheck ( workflowExecuteThread . getProcessInstance ( ) ) ;
// secondly, the `multiThreadFilterMap` cannot be remove the `workflowExecuteThread`, resulting in the state of process instance cannot be changed and memory leak
processInstanceExecCacheManager . removeByProcessInstanceId ( processInstanceId ) ;
try {
notifyProcessChanged ( workflowExecuteThread . getProcessInstance ( ) ) ;
if ( workflowExecuteThread . workFlowFinish ( ) ) {
logger . info ( "process instance {} finished." , processInstanceId ) ;
stateWheelExecuteThread . removeProcess4TimeoutCheck ( workflowExecuteThread . getProcessInstance ( ) ) ;
processInstanceExecCacheManager . removeByProcessInstanceId ( processInstanceId ) ;
notifyProcessChanged ( workflowExecuteThread . getProcessInstance ( ) ) ;
logger . info ( "process instance {} finished." , processInstanceId ) ;
}
} catch ( Exception e ) {
logger . error ( "handle events {} success, but notify changed error" , processInstanceId , e ) ;
}
}
multiThreadFilterMap . remove ( workflowExecuteThread . getKey ( ) ) ;
multiThreadFilterMap . remove ( workflowExecuteThread . getKey ( ) ) ;
}
}