摘要:前言 首先再次强调hashcode (==)和equals的真正含义(我记得以前有人会说,equals是判断对象内容,hashcode是判断是否相等之类): equals:是否同一个对象实例。注意,是“实例”。比如String s = new String("test"); s.equals(s),
阅读全文
摘要:1.自旋锁是采用让当前线程不停地的在循环体内执行实现的,当循环的条件被其他线程改变时 才能进入临界区 public class SpinLock { private AtomicReference<Thread> owner =new AtomicReference<>(); public void
阅读全文