84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
@Transactional(isolation=Isolation.SERIALIZABLE)public String modifyStock(){查询库存thread.sleep(10*1000);
修改库存}多线程访问这个方法的时候,线程1查询完库存后进入休眠,线程2查询完库存后进入休眠,线程1休眠结束执行修改库存,线程2休眠结束执行修改库存,线程2报获取锁失败。为什么线程2在查询库存的时候没有报获取锁失败,不是加了SERIALIZABLE锁吗?
认证0级讲师
I feel that there should be no lock when querying, but the logic of queuing and submitting transactions is reflected when the transaction is submitted
I feel that there should be no lock when querying, but the logic of queuing and submitting transactions is reflected when the transaction is submitted