摘要:
由浅入深分析单例模式 单例模式(Singleton Patten):确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例(Ensure a class has only one instance, and provide a global point of access to it)。 阅读全文
摘要:
转自:http://www.verejava.com/?id=17236703718463 锁Lock取款机场景实例 Lock是一个接口,ReentrantLock是它的实现类,下面通过“取款机案例”来剖析它的4个常用方法。 1.爸爸妈妈同时在ATM上登录取款(不加任何锁) public class 阅读全文