摘要:
JUC cpu多核 public class Test1 { public static void main(String[] args) { // 获取cpu核数 // cpu密集型 io密集型 System.out.println(Runtime.getRuntime().availablePr 阅读全文
摘要:
synchronized锁的内容 import java.util.concurrent.TimeUnit; class Test1 { public static void main(String[] args) { Phone phone = new Phone(); new Thread(() 阅读全文
摘要:
Lock锁 源码 Lock public interface Lock { void lock(); void lockInterruptibly() throws InterruptedException; boolean tryLock(); boolean tryLock(long time, 阅读全文
摘要:
虚假唤醒 class A { public static void main(String[] args) { Data data = new Data(); // +1 new Thread(() -> { for (int i = 0; i < 10; i++) { try { data.inc 阅读全文