摘要: 公平锁,非公平锁 公平锁:不能插队,必须先来后到 FIFO 非公平锁:可以插队 可以允许短任务优先(默认) /** * Creates an instance of {@code ReentrantLock}. * This is equivalent to using {@code Reentra 阅读全文
posted @ 2022-01-19 16:11 一刹流云散 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 什么是CAS public class CASDemo { //CAS compareAndSet:比较并交换 public static void main(String[] args) { AtomicInteger atomicInteger=new AtomicInteger(2020); 阅读全文
posted @ 2022-01-19 13:48 一刹流云散 阅读(61) 评论(0) 推荐(0) 编辑