摘要:
饿汉式 public class HungryTest { public static void main(String[] args) throws InterruptedException { for (int i = 0; i < 100; i++) { new Thread(()->{ Sy 阅读全文
摘要:
公平锁/非公平锁 可重入锁 指的是以线程为单位,当一个线程获取对象锁之后,这个线程可以再次获取本对象上的锁,而其他的线程是不可以的。 public class ReenterLockTest { public static void main(String[] args) { new Thread( 阅读全文