feat - 调整拒绝底层异步处理器增加全局功能

This commit is contained in:
wangli 2024-08-09 11:33:42 +08:00
parent a0e08a5520
commit 61ca505b12
3 changed files with 4 additions and 7 deletions

View File

@ -49,5 +49,5 @@ public class BpmnProcessInstanceAbortDTO {
* 是否异步执行
*/
@ApiModelProperty(value = "是否异步", notes = "异步时,只接收请求便返回数据")
private Boolean async = false;
private Boolean async = true;
}

View File

@ -57,7 +57,7 @@ public abstract class AbstractExecuteWithLockJobHandler extends AbstractJobHandl
//删除15分钟前的数据,相当于超时时间是15分钟
extAxPropertyService.deleteByNameWithDuration(processInstanceId, 15L, TimeUnit.MINUTES);
//睡眠2秒
ThreadUtils.sleep(2 * 1000);
ThreadUtils.objectWait(2 * 1000);
acquireCount++;
log.warn("acquireLock error,processInstanceId:{},jobId:{},acquireCount:{}", processInstanceId, jobId, acquireCount);
}

View File

@ -13,10 +13,8 @@ import org.flowable.job.service.impl.persistence.entity.JobEntity;
import org.flowable.variable.api.delegate.VariableScope;
@Slf4j
public class AsyncAbortProcessInstanceHandler extends AbstractJobHandler implements JobHandler {
public class AsyncAbortProcessInstanceHandler extends AbstractExecuteWithLockJobHandler implements JobHandler {
public static final String TYPE = "async-abort-instance";
private final ExtAxHiTaskInstService extAxHiTaskInstService;
public AsyncAbortProcessInstanceHandler(ExtAxHiTaskInstService extAxHiTaskInstService) {
@ -29,13 +27,12 @@ public class AsyncAbortProcessInstanceHandler extends AbstractJobHandler impleme
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
void executeInternal(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
log.info("AsyncAbortProcessInstanceHandler executing...,jobInfo:{}", JSONUtil.toJsonStr(job));
log(job);
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
BpmnProcessInstanceCancelDTO dto = JSONUtil.toBean(job.getCustomValues(), BpmnProcessInstanceCancelDTO.class);
processEngineConfiguration.getCommandExecutor().execute(new CustomAbortProcessInstanceCmd(dto.getProcessInstanceId(), dto.getTenantId(),
dto.getReason(), extAxHiTaskInstService));
}
}