05 2022 档案

摘要:三大方法,七大参数,四种拒绝策略 三大方法 ExecutorService threadPool = Executors.newSingleThreadExecutor();//单个线程 ExecutorService threadPool2 = Executors.newFixedThreadPo 阅读全文
posted @ 2022-05-19 14:11 九月!! 阅读(19) 评论(0) 推荐(0) 编辑
摘要:阻塞队列 阻塞 写入:如果队列中数据满了,就得阻塞等待 读取:如果队列中无数据,就得阻塞等待 队列 队列遵循FIFO规则 BlockingQueue族谱 BlockingQueue 四种API(四种方法) 方式 抛出异常 不抛异常,正常返回值 阻塞等待 超时等待 添加 add offer put o 阅读全文
posted @ 2022-05-11 17:34 九月!! 阅读(26) 评论(0) 推荐(0) 编辑
摘要:/** * 独占锁(写锁):一次只能被一个线程占用 * 共享锁(读锁):多个线程可以同时占有 * ReadWriteLock 是接口 ReentrantReadWriteLock是他的一个实现类 * 读-读: 可以共享 * 读-写: 不可共享 * 写-写: 不可共享 */ public class 阅读全文
posted @ 2022-05-11 16:23 九月!! 阅读(30) 评论(0) 推荐(0) 编辑
摘要:public class Test { public static void main(String[] args) throws ExecutionException, InterruptedException { new Thread1().start(); new Thread(new Thr 阅读全文
posted @ 2022-05-11 15:19 九月!! 阅读(19) 评论(0) 推荐(0) 编辑
摘要:List不安全 List: //java.util.ConcurrentModificationException 并发修改异常! public class ListTest { public static void main(String[] args) { List<Object> arrayL 阅读全文
posted @ 2022-05-11 15:10 九月!! 阅读(32) 评论(0) 推荐(0) 编辑
摘要:CountDownLatch的使用 /* 减法计数器 */ public class Test1 { public static void main(String[] args) throws InterruptedException { CountDownLatch countDownLatch 阅读全文
posted @ 2022-05-11 11:01 九月!! 阅读(15) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示