Tasks.scheduleAtFixedRate同时开启多个任务会造成锁安全吗
6 回复
public void getOrderToSend(){
Tasks.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
testJob.sendOrder(QueueEnum.ONE);
}
}, 1,1000, TimeUnit.MILLISECONDS);
}
public void getOrderToSend2(){
Tasks.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
testJob.sendOrder(QueueEnum.SECOND);
}
}, 1,1000*60, TimeUnit.MILLISECONDS);
}
//定时回调商户订单(补单)
public void getOrderToSend3(){
Tasks.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
testJob.sendOrder(QueueEnum.THREE);
}
}, 1,1000*60*30, TimeUnit.MILLISECONDS);
}
三个定时任务同时调用一个方法
这得看具体的数据库操作了
来自炫酷的 NutzCN
添加回复
请先登陆