摘要:
案例 package com.wt.forkjoin; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveT 阅读全文
posted @ 2025-06-02 17:13
市丸银
阅读(3)
评论(0)
推荐(0)
摘要:
一、七个参数 int corePoolSize, // 常驻线程数量(核心) int maximumPoolSize, // 最大线程数量 long keepAliveTime, // 线程存活时间 TimeUnit unit, // 线程存活单位 BlockingQueue<Runnable> w 阅读全文
posted @ 2025-06-02 16:00
市丸银
阅读(7)
评论(0)
推荐(0)
摘要:
一、一池N线程 ExecutorService pool = Executors.newFixedThreadPool(5); 二、一池一个线程 ExecutorService pool = Executors.newSingleThreadExecutor(); 三、一池可变线程,遇强则强 Exe 阅读全文
posted @ 2025-06-02 14:45
市丸银
阅读(3)
评论(0)
推荐(0)
摘要:
一、用法 方法类型 异常抛出 特殊值 阻塞 超时 插入 add(e) offer(e) put(e) offer(e,time,unit) 移除 remove() poll() take() poll(time,unit) 检查 element() peek() 不可用 不可用 二、案例 packa 阅读全文
posted @ 2025-06-02 14:11
市丸银
阅读(6)
评论(0)
推荐(0)
摘要:
一、注意 写锁可以降级为读锁,读锁不能升级为写锁 二、过程 1、写锁 2、读锁 3、释放写锁 4、释放读锁 三、案例 package com.wt.readwrite; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * @ 阅读全文
posted @ 2025-06-02 10:55
市丸银
阅读(15)
评论(0)
推荐(0)
摘要:
一、语法 private ReadWriteLock rwLock = new ReentrantReadWriteLock(); // 上锁 rwLock.writeLock().lock(); // 释放锁 rwLock.writeLock().unlock(); 二、案例 存入、读取 map数 阅读全文
posted @ 2025-06-02 10:10
市丸银
阅读(4)
评论(0)
推荐(0)

浙公网安备 33010602011771号