pooledconnection.java

来自「本人课程设计时做的一个用struts框架实现的基于cmmi2的项目管理系统的原型」· Java 代码 · 共 74 行

JAVA
74
字号
package com.cmmi2pms.common.comdb;/**  * connection object *  * @author xunzy * @version 0.01 * */public class PooledConnection{	// The JDBC Connection	public java.sql.Connection con;		// true if this connection is currently in use	public boolean inUse;		// The last time (in milliseconds) that this connection was used	public long lastAccess;		// The number of times this connection has been used	public int useCount;		private long timeTagID;		/**	 * Default constructor	 */	public PooledConnection()	{		java.util.Date d = new java.util.Date();		timeTagID = (long) d.getTime();	}	public long getTimeTagID()	{		return timeTagID;		}	/**	* <p>Determine if the connection is available	*	* @return true if the connection can be used	*/	public boolean isAvailable()	{		boolean available = false;				try
		{					// To be available, the connection cannot be in use			// and must be open			if (con != null)
			{				if (!inUse &&!con.isClosed())
				{					available = true;				}			}		}		catch (Exception ex){}				return available;	}		/**	* <p>Convert the object contents to a String	*/	public String toString()	{		return "Connection=" + con + ",inUse=" + inUse +		",lastAccess=" + lastAccess + ",useCount=" + useCount;	}}

⌨️ 快捷键说明

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