当前位置:网站首页>线程执行测试效果
线程执行测试效果
2022-08-10 03:19:00 【道阻且长-行则将至-行而不辍-未来可期】
目录
前言描述:
主要是执行线程进行同步,简单的一个线程,后来废弃掉了,所以代码备份到这里
主要得线程代码
@Data
private class SendCorpusRunnable implements Runnable {
private Long newsId;
private List<TbmPopularFeelings> eventInfoList;
private Map<Long, List<TbmEventTags>> eventTagsMap;
public SendCorpusRunnable(Long newsId, List<TbmPopularFeelings> eventInfoList,
Map<Long, List<TbmEventTags>> eventTagsMap) {
this.newsId = newsId;
this.eventInfoList = eventInfoList;
this.eventTagsMap = eventTagsMap;
}
@Override
public void run() {
try {
NewsEventVo newsEventVo = TbmEventConvert.convertToCorpus(newsId, eventInfoList, eventTagsMap);
newsEventFacade.save(newsEventVo);
} catch (CorpusException e) {
e.printStackTrace();
}
}
}测试的地方里面的方法体进行的逻辑处理
/**
* 转换推送语料数据
*
* @param eventInfoList
* @return
*/
public static NewsEventVo convertToCorpus(Long newsId, List<TbmPopularFeelings> eventInfoList, Map<Long, List<TbmEventTags>> eventTagsMap) {
NewsEventVo newsEventVo = new NewsEventVo();
newsEventVo.setNewsId(newsId);
if (CollectionUtils.isEmpty(eventInfoList)) {
return newsEventVo;
}
List<NewsEventVo.EventCalloutVo> eventCalloutVoList = new ArrayList<>();
eventInfoList.forEach(eventInfo -> {
NewsEventVo.EventCalloutVo eventCalloutVo = new NewsEventVo.EventCalloutVo();
if (StringUtils.isNotBlank(eventInfo.getEventFourthLevelCode())) {
eventCalloutVo.setEventCode(eventInfo.getEventFourthLevelCode());
}
if (StringUtils.isNotBlank(eventInfo.getEventFourthLevel())) {
eventCalloutVo.setEventName(eventInfo.getEventFourthLevel());
}
if (StringUtils.isNotBlank(eventInfo.getEventBasis())) {
eventCalloutVo.setEventBasis(eventInfo.getEventBasis());
}
//提取标签主体
List<TbmEventTags> eventTagList = eventTagsMap.get(eventInfo.getId());
List<NewsEventVo.EventSubjectVo> subjectList = new ArrayList<>();
if (!CollectionUtils.isEmpty(eventTagList)) {
eventTagList.forEach(eventTag -> {
NewsEventVo.EventSubjectVo eventSubjectVo = new NewsEventVo.EventSubjectVo();
eventSubjectVo.setSubjectName(eventTag.getTagName());
if (StringUtils.isNotBlank(eventTag.getMainBasis())) {
eventSubjectVo.setSubjectBasis(eventTag.getMainBasis());
}
subjectList.add(eventSubjectVo);
});
}
eventCalloutVo.setSubjectList(subjectList);
eventCalloutVoList.add(eventCalloutVo);
});
newsEventVo.setEventList(eventCalloutVoList);
return newsEventVo;
}调用的时候:
// 发送语料平台,异步
ThreadPoolExecutor threadPoolExecutor = ThreadPoolExecutorFactory.getThreadPoolExecutor();
threadPoolExecutor.submit(new SendCorpusRunnable(newsId, tbmPopularFeelingsList, eventTagsMap)); // 发送语料平台,异步
ThreadPoolExecutor threadPoolExecutor = ThreadPoolExecutorFactory.getThreadPoolExecutor();
threadPoolExecutor.submit(new SendCorpusRunnable(newsId, tbmPopularFeelingsList, eventTagsMap));边栏推荐
- Flink Table&Sql API使用遇到的问题总结
- 【Verilog数字系统设计(夏雨闻)5-------模块的结构、数据类型、变量和基本运算符号1】
- 使用 requestAnimationFrame 提升 web 性能
- 书法家唐效奇
- yolov5+usb相机
- Recommend several easy-to-use MySQL open source clients, it is recommended to collect
- 清洁环保的小型风电滑环基本介绍
- The same is a primary test, why does he pay 5,000 yuan more than me?
- @Autowired注解 --required a single bean, but 2 were found出现的原因以及解决方法
- 新零售社交电商APP系统平台如何打造公域+私域流量?
猜你喜欢

2022/08/09 学习笔记 (day26) IO流

常用类以及接口

动态网页开发基础

Classes and interfaces

快35了,还在“点点点”?那些入行几年的测试点工后来都怎么样了?

Small program subcontracting and subcontracting pre-download

如何让导电滑环信号更好

Difference between netstat and ss command

It's almost 35, still "did a little"?What happened to the test workers who had been in the industry for a few years?

【2022河南萌新联赛第(五)场:信息工程大学】【部分思路题解+代码解析】
随机推荐
yolov5+usb相机
小程序分包及分包预下载
Mini Program Navigation and Navigation Parameters
Day16 charles的基本使用
互联网公司高频面试题精讲:测试计划和测试方案有什么区别?
量化投资学习——在FPGA上运行高频交易策略
Example 044: Matrix Addition
小程序导航及导航传参
The same is a primary test, why does he pay 5,000 yuan more than me?
软件的生命周期(软件工程各阶段的工作)
【单调栈】【概念讲解&&模板代码】
PC摄像头设置 默认摄像头设置 win11 默认摄像头设置
goland控制台显示重叠问题解决方案
PostgreSQL相关语法及指令示例
论文理解:“PIAT: Physics Informed Adversarial Training for Solving Partial Differential Equations“
如何快速成为一名软件测试工程师?测试员月薪15k需要什么技术?
过水滑环的结构和工作原理
兴业数金一面
charles的功能操作
Flink学习15:Flink自定义数据源