/**
* @program: data-transmission-platform
* @description:
* @author: chengh
* @create: 2020-04-02 17:44
**/
@Slf4j
@Service
public class AsyncServiceImpl implements AsyncService {
private int tick = 100;
@Override
@Async("asyncServiceExecutor")
public void executeAsync(SourceInfo sourceInfo) {
//线程单例验证-单列,线程中全局变量共同使用&&线程入参对象验证-各个线程中的入参对象指向各自的引用,并不会因为其他线程的启动而改变
while(true)
{
if(tick>0)
{
System.out.println(Thread.currentThread().getName()+"....sale : "+ tick--);
System.out.println(sourceInfo.getProduceName()+Thread.currentThread().getName());
}
}
}
}
public void executeSchedule() {
log.info("====定时请求数据任务开始====");
//查询出开通的平安智贷源信息
List<SourceInfo> sourceInfoList = iSourceInfoService.selectList(new EntityWrapper<SourceInfo>().eq("status", Integer.valueOf("0")).eq("source", Integer.valueOf("1")));
//平安智贷资源遍历
for (SourceInfo sourceInfo :
sourceInfoList) {
// queryAndStoreData(sourceInfo);
asyncService.executeAsync(sourceInfo);
}
log.info("====定时请求数据任务结束====");
}
结果:
async-service-1....sale : 100
async-service-3....sale : 99
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 98
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 97
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 96
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 95
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 94
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 93
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 92
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 91
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 90
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 89
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 88
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 87
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 86
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 85
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 84
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 83
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 82
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 81
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 80
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 79
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 78
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 77
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 76
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 75
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 74
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 73
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 72
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 71
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 70
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 69
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 68
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 67
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 66
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 65
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 64
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 63
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 62
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 61
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 60
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 59
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 58
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 57
标准对账信息查询功能-还款async-service-3
async-service-2....sale : 100
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 55
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 54
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 53
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 52
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 51
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 50
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 49
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 48
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 47
标准对账信息查询功能-放款async-service-2
async-service-2....sale : 46
标准对账信息查询功能-放款async-service-2
async-service-3....sale : 56
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 44
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 43
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 42
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 41
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 40
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 39
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 38
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 37
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 36
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 35
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 34
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 33
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 32
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 31
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 30
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 29
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 28
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 27
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 26
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 25
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 24
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 23
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 22
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 21
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 20
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 19
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 18
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 17
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 16
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 15
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 14
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 13
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 12
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 11
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 10
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 9
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 8
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 7
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 6
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 5
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 4
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 3
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 2
标准对账信息查询功能-还款async-service-3
async-service-3....sale : 1
标准对账信息查询功能-还款async-service-3
2020-04-08 15:15:22.752 [main] INFO c.s.data.transmission.platform.schedule.QueryData Line:55 -----> ====定时请求数据任务结束====
核额信息查询async-service-1
async-service-2....sale : 45
标准对账信息查询功能-放款async-service-2