摘要:
单例模式确保一个类只有一个实例,并提供一个全局访问点。类图:Singletonstatic uniqueInstance//其他属性...static getInstance()//其他方法...使用单例模式得需要考虑到多线程环境下的问题,以下为几种解决方法:1、同步getInstance()public class Singleton{ private static Singleton uniqueInstance; private Singleton(){} public static synchronized Singleton ... 阅读全文
posted @ 2013-06-27 22:06 TripleKing 阅读(160) 评论(0) 推荐(0)