论坛首页 入门技术论坛

配置文件辅助类

浏览 1190 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-09-21  
package com.yunchow.util;

/**
 * read the jdbc connection information
 * @author yunchow
 * @version 1.2  09/8/17
 */
final class JdbcConfigBean extends java.util.Properties {
	
	private static final long serialVersionUID = 1L;
	private static JdbcConfigBean instance;
	private static final byte[] lock = new byte[0];
	
	private JdbcConfigBean() {
		try {
			load(JdbcConfigBean.class.getClassLoader().getResourceAsStream("jdbc.ini"));
		} catch(Exception ex) {
			throw new ExceptionInInitializerError(ex);
		}
	}
	
	public static JdbcConfigBean getInstance() {
		if(instance == null) {
			synchronized(lock) {
				if(instance == null) {
					instance = new JdbcConfigBean();
				}
			}
		}
		// System.out.println("Jdbc config bean ->" + instance);
		return instance;
	}
	
	
}
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics