摘要:
单件模式,又称单例模式 /** * 单例,版本一,此版本多线程下有问题。不要使用 */ public class Singleton00 { private Singleton00() { } private static Singleton00 uniqueInstance; public sta 阅读全文
posted @ 2021-07-06 21:33
htj10
阅读(79)
评论(0)
推荐(0)
摘要:
同步代码块,是锁这个对象 synchronized (this){...} 同步实例方法,也是锁这个对象 public synchronized void fun1(){ ... } 相当于将方法里的所有语句用synchronized (this){}包裹 public void fun1(){ s 阅读全文
posted @ 2021-07-06 15:23
htj10
阅读(59)
评论(0)
推荐(0)

浙公网安备 33010602011771号