1、悲观锁不支持并发,效率低下,乐观锁支持并发使用版本号
2、使用读写锁
读锁是共享锁
写锁是独占锁
private ReadWriteLock readWriteLock = new ReentrantReadWriteLock();//读写锁对象
readWriteLock.readLock().lock();//读加锁
readWriteLock.readLock().unlock();//读解锁
readWriteLock.writeLock().lock();//写加锁
readWriteLock.writeLock().unlock();//写解锁
3、
4、读写锁降级