摘要: 1. 配置文件<configuration><configSections><sectionGroupname="spring"><sectionname="context"type="Spring.Context.Support.ContextHandler,Spring.Core"/><sectionname="objects"type="Spring.Context.Support.DefaultSectionHandler,Spring.Cor 阅读全文
posted @ 2012-05-30 15:39 Master HaKu 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 1. 经典的设计模式中的代码publicclassSingleton{privatestaticSingletoninstance;//唯一实例protectedSingleton(){}//封闭客户程序的直接实例化publicstaticSingletonInstance{get{if(instance==null)instance=newSingleton();returninstance;}}} 在多线程环境下存在缺陷, 最终将会保存最后创建的那个实例2. 改进后的多线程SingletonclassSingleton{privateSingleton(){}[ThreadStatic]. 阅读全文
posted @ 2012-05-30 13:42 Master HaKu 阅读(464) 评论(0) 推荐(0) 编辑