亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 一個連接池的例子(來自jive)(3).txt

?? java學習文檔
?? TXT
字號:
作者:sonymusic
email: sonymusic@china.com
日期:2001-5-17 11:34:25
//文件:DbConnectionDefaultPool.java的第三部分


		/**
		 * Returns the age of a connection -- the time since it was handed out to
		 * an application.
		 */
		public long getAge(Connection conn) { // Returns the age of the connection in millisec.
			int thisconn = idOfConnection(conn);
			return System.currentTimeMillis() - connLockTime[thisconn];
		}

		private void createConn(int i) throws SQLException {
			 Date now = new Date();
			 try {
				Class.forName (dbDriver);
				Properties dbProp = new Properties();
				//log.println("Creating.....");
				dbProp.put("user", dbLogin);
				dbProp.put("password", dbPassword);
				dbProp.put("characterEncoding","gb2112");
				//dbProp.put("useUnicode", "true");
		
				connPool[i] = DriverManager.getConnection
						  (dbServer,dbProp);
				//log.println("Created Ok...");
				connStatus[i]=0;
				connID[i]=connPool[i].toString();
				connLockTime[i]=0;
				connCreateDate[i] =  now.getTime();
			}
			catch (ClassNotFoundException e2) {}
				
			log.println(now.toString() + "  Opening connection " + String.valueOf(i) +
					" " + connPool[i].toString() + ":");
		}
	
		/**
		 * Shuts down the housekeeping thread and closes all connections
		 * in the pool. Call this method from the destroy() method of the servlet.
		 */

		/**
		 * Multi-phase shutdown.  having following sequence:
		 * <OL>
		 * <LI><code>getConnection()</code> will refuse to return connections.
		 * <LI>The housekeeping thread is shut down.<br>
		 *    Up to the time of <code>millis</code> milliseconds after shutdown of
		 *    the housekeeping thread, <code>freeConnection()</code> can still be
		 *    called to return used connections.
		 * <LI>After <code>millis</code> milliseconds after the shutdown of the
		 *    housekeeping thread, all connections in the pool are closed.
		 * <LI>If any connections were in use while being closed then a
		 *    <code>SQLException</code> is thrown.
		 * <LI>The log is closed.
		 * </OL><br>
		 * Call this method from a servlet destroy() method.
		 *
		 * @param      millis   the time to wait in milliseconds.
		 * @exception  SQLException if connections were in use after
		 * <code>millis</code>.
		 */
		public void destroy(int millis) throws SQLException {
	
			// Checking for invalid negative arguments is not necessary,
			// Thread.join() does this already in runner.join().

			// Stop issuing connections
			available=false;

			// Shut down the background housekeeping thread
			runner.interrupt();

			// Wait until the housekeeping thread has died.
			try { runner.join(millis); }
			catch(InterruptedException e){} // ignore
		
			// The housekeeping thread could still be running
			// (e.g. if millis is too small). This case is ignored.
			// At worst, this method will throw an exception with the
	        // clear indication that the timeout was too short.

			long startTime=System.currentTimeMillis();

			// Wait for freeConnection() to return any connections
			// that are still used at this time.
			int useCount;
			while((useCount=getUseCount())>0 && System.currentTimeMillis() - startTime <=  millis) {
				try { Thread.sleep(500); }
				catch(InterruptedException e) {} // ignore
			}

			// Close all connections, whether safe or not
			for(int i=0; i < currConnections; i++) {
				try {
					connPool[i].close();
				}
				catch (SQLException e1)
				{
					log.println("Cannot close connections on Destroy");
				}
			}

			if(useCount > 0) {
				//bt-test successful
				String msg="Unsafe shutdown: Had to close "+useCount+
		            " active DB connections after "+millis+"ms";
				log.println(msg);
				// Close all open files
				log.close();
				// Throwing following Exception is essential because servlet authors
				// are likely to have their own error logging requirements.
				throw new SQLException(msg);
			}

			// Close all open files
			log.close();

		}//End destroy()


		/**
		 * Less safe shutdown.  Uses default timeout value.
		 * This method simply calls the <code>destroy()</code> method
		 * with a <code>millis</code>
		 * value of 10000 (10 seconds) and ignores <code>SQLException</code>
		 * thrown by that method.
		 * @see     #destroy(int)
		 */
		public void destroy() {
			try {
				destroy(10000);
			}
			catch(SQLException e) {}
		}

		/**
		 * Returns the number of connections in use.
		 */
		// This method could be reduced to return a counter that is
		// maintained by all methods that update connStatus.
		// However, it is more efficient to do it this way because:
		// Updating the counter would put an additional burden on the most
		// frequently used methods; in comparison, this method is
		// rarely used (although essential).
		public int getUseCount() {
			int useCount=0;
			synchronized(connStatus) {
				for(int i=0; i < currConnections; i++) {
					if(connStatus[i] > 0) { // In use
						useCount++;
					}
				}
			}
			return useCount;
		}//End getUseCount()

		/**
		 * Returns the number of connections in the dynamic pool.
		 */
		public int getSize() {
			return currConnections;
		}//End getSize()

	}

	/**
	 * An implementation of the Connection interface that wraps an underlying
	 * Connection object. It releases the connection back to a connection pool
	 * when Connection.close() is called.
	 */
	public class ConnectionWrapper  implements Connection {

		private Connection connection;
		private ConnectionPool connectionPool;

		public ConnectionWrapper(Connection connection, ConnectionPool connectionPool) {
			this.connection = connection;
			this.connectionPool = connectionPool;
		}

		/**
		 * Instead of closing the underlying connection, we simply release
		 * it back into the pool.
		 */
		public void close() throws SQLException {
			connectionPool.freeConnection(this.connection);
			//Release object references. Any further method calls on the
			//connection will fail.
			connection = null;
			connectionPool = null;
		}

		public Statement createStatement() throws SQLException {
			return connection.createStatement();
		}

		public PreparedStatement prepareStatement(String sql) throws SQLException {
			return connection.prepareStatement(sql);
		}

		public CallableStatement prepareCall(String sql) throws SQLException {
			return connection.prepareCall(sql);
		}

		public String nativeSQL(String sql) throws SQLException {
			return connection.nativeSQL(sql);
		}

		public void setAutoCommit(boolean autoCommit) throws SQLException {
			connection.setAutoCommit(autoCommit);
		}

		public boolean getAutoCommit() throws SQLException {
			return connection.getAutoCommit();
		}

		public void commit() throws SQLException {
			connection.commit();
		}

		public void rollback() throws SQLException {
			connection.rollback();
		}

		public boolean isClosed() throws SQLException {
			return connection.isClosed();
		}

		public DatabaseMetaData getMetaData() throws SQLException {
			return connection.getMetaData();
		}

		public void setReadOnly(boolean readOnly) throws SQLException {
			connection.setReadOnly(readOnly);
		}

		public boolean isReadOnly() throws SQLException {
			return connection.isReadOnly();
		}

		public void setCatalog(String catalog) throws SQLException {
			connection.setCatalog(catalog);
		}

		public String getCatalog() throws SQLException {
			return connection.getCatalog();
		}

		public void setTransactionIsolation(int level) throws SQLException {
			connection.setTransactionIsolation(level);
		}

		public int getTransactionIsolation() throws SQLException {
			return connection.getTransactionIsolation();
		}

		public SQLWarning getWarnings() throws SQLException {
			return connection.getWarnings();
		}

		public void clearWarnings() throws SQLException {
			connection.clearWarnings();
		}

		public Statement createStatement(int resultSetType, int resultSetConcurrency)
				throws SQLException
		{
			return connection.createStatement(resultSetType, resultSetConcurrency);
		}

		public PreparedStatement prepareStatement(String sql, int resultSetType,
				int resultSetConcurrency) throws SQLException
		{
			return connection.prepareStatement(sql, resultSetType, resultSetConcurrency);
		}

		public CallableStatement prepareCall(String sql, int resultSetType,
				int resultSetConcurrency) throws SQLException
		{
			return prepareCall(sql, resultSetType, resultSetConcurrency);
		}

		public Map getTypeMap() throws SQLException {
			return connection.getTypeMap();
		}

		public void setTypeMap(Map map) throws SQLException {
			connection.setTypeMap(map);
		}

	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区精品视频| 91精品一区二区三区久久久久久| 精品国产一区二区国模嫣然| 喷白浆一区二区| 日韩精品一区二区三区中文不卡 | 欧美韩国一区二区| 国产另类ts人妖一区二区| 欧美激情在线一区二区三区| www.66久久| 亚洲图片欧美综合| 日韩欧美一区二区免费| 国产不卡一区视频| 亚洲人吸女人奶水| 欧美福利视频导航| 国产在线播放一区二区三区| 国产精品护士白丝一区av| 欧美亚洲国产一区二区三区| 丝袜美腿亚洲综合| 欧美极品少妇xxxxⅹ高跟鞋| 91久久久免费一区二区| 日产国产高清一区二区三区| 国产午夜精品在线观看| 欧美色区777第一页| 国内精品久久久久影院薰衣草| 国产日产欧美一区二区视频| 色综合天天综合给合国产| 视频在线观看一区二区三区| 久久精品网站免费观看| 99riav一区二区三区| 人人狠狠综合久久亚洲| 国产精品伦理在线| 日韩一区二区免费视频| 99久久精品免费看| 欧美aaaaaa午夜精品| 国产精品天天看| 91精品午夜视频| 成人高清视频在线| 美美哒免费高清在线观看视频一区二区| 国产性色一区二区| 777亚洲妇女| 色婷婷av一区二区三区大白胸| 精品一区二区三区的国产在线播放| 国产精品少妇自拍| 日韩精品自拍偷拍| 欧美视频在线观看一区二区| 国产河南妇女毛片精品久久久| 亚洲线精品一区二区三区| 国产精品色一区二区三区| 日韩午夜电影在线观看| 91福利精品视频| a在线播放不卡| 国产精品亚洲综合一区在线观看| 亚洲国产精品久久一线不卡| 亚洲欧洲av色图| 久久久精品人体av艺术| 精品理论电影在线| 在线综合亚洲欧美在线视频| 色噜噜久久综合| 成人美女视频在线观看18| 精品亚洲国产成人av制服丝袜 | 国产91精品一区二区麻豆网站 | 亚洲乱码日产精品bd| 久久伊人蜜桃av一区二区| 欧美精品xxxxbbbb| 在线观看亚洲成人| 色老头久久综合| 91在线云播放| 91碰在线视频| av在线一区二区三区| 成人做爰69片免费看网站| 精品一区二区三区免费视频| 日本不卡的三区四区五区| 亚洲高清一区二区三区| 亚洲精品国产精华液| 亚洲精品亚洲人成人网| 亚洲精品中文字幕在线观看| 亚洲精品高清在线| 一级女性全黄久久生活片免费| 亚洲欧洲99久久| 亚洲欧美日韩国产一区二区三区| 1024国产精品| 亚洲欧美激情小说另类| 亚洲成人在线免费| 丝袜a∨在线一区二区三区不卡| 亚洲成av人片在线| 视频一区二区欧美| 久久电影网站中文字幕| 国产在线一区二区综合免费视频| 国产一区二区伦理| 丰满白嫩尤物一区二区| 99热99精品| 欧美性受xxxx黑人xyx| 欧美亚洲一区二区三区四区| 欧美精品粉嫩高潮一区二区| 精品欧美黑人一区二区三区| 久久久久久久久久看片| 国产精品色哟哟| 亚洲高清在线精品| 国产一级精品在线| 99久久精品国产导航| 在线这里只有精品| 日韩欧美电影一区| 国产欧美精品国产国产专区 | 亚洲一级二级三级| 美美哒免费高清在线观看视频一区二区| 精品亚洲成a人在线观看| av午夜精品一区二区三区| 在线亚洲免费视频| 欧美tk丨vk视频| 亚洲同性gay激情无套| 亚洲国产成人av网| 国产成人在线免费观看| 91精品福利在线| 精品日产卡一卡二卡麻豆| 最新不卡av在线| 美女看a上一区| eeuss鲁片一区二区三区在线观看| 欧美日韩亚洲高清一区二区| 26uuu亚洲综合色欧美| 亚洲欧洲制服丝袜| 精彩视频一区二区三区| 99国产欧美久久久精品| 日韩免费视频线观看| 综合色天天鬼久久鬼色| 蜜乳av一区二区| 色偷偷成人一区二区三区91 | jlzzjlzz国产精品久久| 欧美日韩国产123区| 国产精品久久久久久亚洲伦| 日本不卡一二三区黄网| 91久久精品一区二区二区| 久久久99精品免费观看| 亚洲国产欧美另类丝袜| 成人网在线播放| 欧美mv日韩mv国产网站app| 一区二区三区高清在线| 国产精品99久久久久久似苏梦涵| 欧美视频日韩视频在线观看| 国产亚洲短视频| 六月丁香婷婷色狠狠久久| 在线免费不卡视频| 国产精品三级av在线播放| 久久av中文字幕片| 欧美高清激情brazzers| 亚洲精品免费电影| 99麻豆久久久国产精品免费 | 欧美一区二区在线播放| 亚洲欧美日韩中文播放 | 久久久久久99久久久精品网站| 亚洲一区二区三区免费视频| 成人av资源站| 久久品道一品道久久精品| 午夜a成v人精品| 欧洲国内综合视频| 亚洲视频一二三| av在线一区二区| 国产精品美女一区二区三区| 国产在线不卡一卡二卡三卡四卡| 欧美一区二区三区在线电影| 亚洲小说欧美激情另类| 欧美亚洲综合网| 亚洲成人自拍一区| 欧美日韩国产综合一区二区| 亚洲一区中文日韩| 欧美无人高清视频在线观看| 一区二区三区美女视频| 91搞黄在线观看| 亚洲成人精品影院| 欧美肥妇bbw| 丝袜a∨在线一区二区三区不卡| 欧美日韩一区高清| 水蜜桃久久夜色精品一区的特点| 欧美精选一区二区| 免费黄网站欧美| 欧美va亚洲va在线观看蝴蝶网| 精品在线视频一区| 久久久激情视频| 成人18精品视频| 亚洲裸体xxx| 欧美日韩一区在线| 免费观看91视频大全| 欧美成人一区二区三区片免费| 久久66热偷产精品| 日本一区二区免费在线观看视频 | 国产福利91精品一区二区三区| 久久九九久精品国产免费直播| 国产精品99久久久久久有的能看| 国产精品丝袜黑色高跟| 色综合久久久久网| 五月婷婷久久综合| 26uuu成人网一区二区三区| 国产成人午夜高潮毛片| 中文字幕在线播放不卡一区| 欧美亚洲国产一卡| 久久激情五月婷婷| 国产精品黄色在线观看| 欧美日韩精品是欧美日韩精品| 久久99精品国产麻豆婷婷| 国产日产欧美一区| 欧美主播一区二区三区|