子线程测试
This commit is contained in:
parent
5b9376d3b7
commit
3d962752bd
@ -103,7 +103,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
@Autowired
|
||||
private DingtalkBusiness dingtalkBusiness;
|
||||
|
||||
List<ThreadInitFlowRecord> threads = new ArrayList<>();
|
||||
List<ThreadInitFlowRecord> threadInitFlowRecords = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
@ -811,9 +811,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
private void initFlowRecordAnsy(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
||||
if(resultRecords.size() > 0){
|
||||
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords, noticeStaff);
|
||||
threadInitFlowRecords.add(threadInitFlowRecord);//防止提前回收
|
||||
Thread thread = new Thread(threadInitFlowRecord);
|
||||
thread.start();
|
||||
threads.add(threadInitFlowRecord);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -841,7 +842,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
//ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
|
||||
threads.remove(this);
|
||||
threadInitFlowRecords.remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +77,8 @@ public class DingtalkBusiness {
|
||||
@Resource
|
||||
StaffDao staffDao;
|
||||
|
||||
List<ThreadSendMessage> threadSendMessages = new ArrayList<>();
|
||||
|
||||
|
||||
@Value("${dingtalk.appid}")
|
||||
private String appid;
|
||||
@ -257,8 +259,10 @@ public class DingtalkBusiness {
|
||||
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
|
||||
|
||||
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
|
||||
threadSendMessages.add(threadSendMessage);//防止提前回收
|
||||
Thread thread = new Thread(threadSendMessage);
|
||||
thread.start();
|
||||
|
||||
return "OK";
|
||||
}
|
||||
return "error";
|
||||
@ -391,6 +395,7 @@ public class DingtalkBusiness {
|
||||
logger.info("ThreadSendMessage token无效"); ;
|
||||
}
|
||||
}
|
||||
threadSendMessages.remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user