摘要:
一、概念 JVM中,单例对象只有一个实例存在。 二、饿汉式实现 public class Singleton { private static Singleton instance = new Singleton(); private Singleton() { } public static Si 阅读全文
摘要:
@ 背景 相信大部分人在看AQS的时候都能看到注释上有这么一段话: The wait queue is a variant of a "CLH" (Craig, Landin, and Hagersten) lock queue. 为了更好的理解AQS中使用锁的思想,所以决定先好好理解CLH锁。 在 阅读全文
摘要:
JDK源码的使用 最近在JDK源码中闲逛,无意中看到了java.lang.reflect.Modifier这个类,这个类很简单,都是些常量定义和判断方法,于是扒了扒代码实现的含义,我们就看个isPublic方法吧: /** * Return {@code true} if the integer a 阅读全文