描述了Java并发编程时,单例模式的延迟初始化问题及解决方案。
单例模式:
public class singleton {
private singleton(){}
private static class instanceHolder{
static singleton instance = new singleton();
}
public static singleton getInstance(){
return instanceHolder.instance;
}
}
延迟初始化静态变量:
public class singleton {
private static attribute instance;
private static class instanceHolder{
static attribute instance = new attribute();
}
public static attribute getInstance(){
return instanceHolder.instance;
}
}
class attribute{}
多种java设计模式
深入潜出地介绍了Java序列化机制及其使用
介绍了如何使用Apache开源项目Common Pool构建自己的对象池

2731

被折叠的 条评论
为什么被折叠?



