⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectionpoolfactory.java

📁 this is example use EJB with jboss.
💻 JAVA
字号:
/*
 * Copyright(C) 2008, NTT AT Co., Ltd.
 * Project: AWGStar
 *
 * Notes:
 *  N/A
 *
 * Record of change:
 * Date         Version      Name       Content
 * 2008/12/15   1.0          TriNT      First create       
 */
package jp.co.ntt.awgview.server.dao;

import jp.co.ntt.awgview.server.common.LogWriter;
import jp.co.ntt.awgview.server.constant.DBConstants;

/**
 * Class name : ConnectionPoolFactory<BR>
 * 
 * Package : jp.co.nttat.awgstar.server.dao <BR>
 * 
 * Description: Connection Pool Factory. Use to get connection to a database <BR>
 * 
 * @author : AI&T
 * @version : 1.0
 */
public class ConnectionPoolFactory {
	/**
	 * Empty constructor
	 */	

	public ConnectionPoolFactory() {
	}

	/***
	 * Use to get connection to a database
	 * 
	 * @return ConnectionPool
	 * @throws Exception
	 */
	public static ConnectionPool getConnectionPool() throws
		Exception {
		ConnectionPool amPool = null;
		String className = null;
		try {			
			className = DBConstants.CONNECTIONPOOL_CLASS;			
			if (className != null) {
				amPool = (ConnectionPool) Class.forName(className).newInstance();
			}
		} catch (ClassNotFoundException cnfe) {			
			LogWriter.getDBLogger().error("Could not locate class [" + className + "]"  + cnfe.toString());
			throw cnfe;
		} catch (InstantiationException ie) {
			LogWriter.getDBLogger().error("Object could not instantialed " + ie.toString());
			throw ie;
		} catch (IllegalAccessException iae) {			
			LogWriter.getDBLogger().error("Could nod access definition of class " + iae.toString());
			throw iae;
		}
		
		if (amPool == null) {
			throw new Exception("Could not instantiated");		
		} else {
			return amPool;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -