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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? googoostatementcache.java

?? c3p0數(shù)據(jù)庫(kù)連接池實(shí)現(xiàn)源碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* * Distributed as part of c3p0 v.0.9.1-pre6 * * Copyright (C) 2005 Machinery For Change, Inc. * * Author: Steve Waldman <swaldman@mchange.com> * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1, as  * published by the Free Software Foundation. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this software; see the file LICENSE.  If not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */package com.mchange.v2.c3p0.stmt;import java.util.*;import java.sql.*;import java.lang.reflect.*;import com.mchange.v2.async.AsynchronousRunner;import com.mchange.v2.sql.SqlUtils;import com.mchange.v2.log.*;import com.mchange.v1.db.sql.StatementUtils;import com.mchange.v2.holders.ChangeNotifyingSynchronizedIntHolder; //req'd only for oracle bug workaroundpublic abstract class GooGooStatementCache{    private final static MLogger logger = MLog.getLogger( GooGooStatementCache.class );    /* MT: protected by this's lock */    // contains all statements in the cache,     // organized by connection    ConnectionStatementManager cxnStmtMgr;    // contains all statements in the cache,     // bound to the keys that produced them    HashMap stmtToKey      = new HashMap();    // maps all known keys to their set of statements    // and to a queue of statements, if any, available    // for checkout    HashMap keyToKeyRec    = new HashMap();        // contains all checked out statements -- in the cache,     // but not currently available for checkout, nor for    // culling in case of overflow    HashSet checkedOut = new HashSet();        int stmt_count;    /* MT: end protected by this' lock */    /* MT: protected by its own lock */    AsynchronousRunner blockingTaskAsyncRunner;    // This set is used to ensure that multiple threads    // do not try to remove the same statement from the    // cache, if for example a Statement is both deathmarched    // away and its parent Connection is closed.    //    // ALL ACCESS SHOULD BE EXPLICITLY SYNCHRONIZED    // ON removalPending's lock!    HashSet removalPending = new HashSet();    /* MT: end protected by its own lock */    public GooGooStatementCache(AsynchronousRunner blockingTaskAsyncRunner)    { 	this.blockingTaskAsyncRunner = blockingTaskAsyncRunner; 	this.cxnStmtMgr = createConnectionStatementManager();    }    abstract ConnectionStatementManager createConnectionStatementManager();    public synchronized Object checkoutStatement( Connection physicalConnection,						  Method stmtProducingMethod, 						  Object[] args )	throws SQLException    {	Object out = null;	StatementCacheKey key = StatementCacheKey.find( physicalConnection, 							stmtProducingMethod, 							args );	LinkedList l = checkoutQueue( key );	if (l == null || l.isEmpty()) //we need a new statement	    {		// we might wait() here... 		// don't presume atomicity before and after!		out = acquireStatement( physicalConnection, stmtProducingMethod, args );		if ( prepareAssimilateNewStatement( physicalConnection ) )		    assimilateNewCheckedOutStatement( key, physicalConnection, out );		// else case: we can't assimilate the statement...		// so, we just return our newly created statement, without caching it.		// on check-in, it will simply be destroyed... this is an "overload statement"	    }	else //okay, we can use an old one	    {  		if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)		    logger.finest(this.getClass().getName() + " ----> CACHE HIT");  		    //System.err.println("-------------> CACHE HIT!");		out = l.get(0);		l.remove(0);		if (! checkedOut.add( out ))		    throw new RuntimeException("Internal inconsistency: " +					       "Checking out a statement marked " + 					       "as already checked out!");		removeStatementFromDeathmarches( out, physicalConnection );	    }	if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)	    { 		//System.err.print("checkoutStatement(): ");		//printStats();		if (logger.isLoggable(MLevel.FINEST))		    logger.finest("checkoutStatement: " + statsString());	    }	return out;    }    public synchronized void checkinStatement( Object pstmt )	throws SQLException    {	if (checkedOut == null) //we're closed	    {		synchronousDestroyStatement( pstmt );		return;	    }	else if (! checkedOut.remove( pstmt ) )	    {		if (! ourResource( pstmt ) ) //this is not our resource, or it is an overload statement		    destroyStatement( pstmt ); // so we just destroy		//in the else case, it's already checked-in, so we ignore				return;	    }	try	    { refreshStatement( (PreparedStatement) pstmt ); }	catch (Exception e)	    {		if (Debug.DEBUG)		    {// 			System.err.println("Problem with checked-in Statement, discarding.");// 			e.printStackTrace();			if (logger.isLoggable(MLevel.INFO))			    logger.log(MLevel.INFO, "Problem with checked-in Statement, discarding.", e);		    }				// swaldman -- 2004-01-31: readd problem statement to checkedOut for consistency		// the statement is not yet checked-in, but it is removed from checked out, and this		// violates the consistency assumption of removeStatement(). Thanks to Zach Scott for		// calling attention to this issue.		checkedOut.add( pstmt );		removeStatement( pstmt, true ); //force destruction of the statement even though it appears checked-out		return;	    }	StatementCacheKey key = (StatementCacheKey) stmtToKey.get( pstmt );	if (Debug.DEBUG && key == null)	    throw new RuntimeException("Internal inconsistency: " +				       "A checked-out statement has no key associated with it!");	LinkedList l = checkoutQueue( key );	l.add( pstmt );	addStatementToDeathmarches( pstmt, key.physicalConnection );	if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)	    {// 		System.err.print("checkinStatement(): ");// 		printStats();		if (logger.isLoggable(MLevel.FINEST))		    logger.finest("checkinStatement(): " + statsString());	    }    }    public synchronized void checkinAll(Connection pcon)	throws SQLException    {	//new Exception("checkinAll()").printStackTrace();	Set stmtSet = cxnStmtMgr.statementSet( pcon );	if (stmtSet != null)	    {		for (Iterator ii = stmtSet.iterator(); ii.hasNext(); )		    {			Object stmt = ii.next();			if (checkedOut.contains( stmt ))			    checkinStatement( stmt );		    }	    }	if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)	    {// 		System.err.print("checkinAll(): ");// 		printStats();		if (logger.isLoggable(MLevel.FINEST))		    logger.log(MLevel.FINEST, "checkinAll(): " + statsString());	    }    }    /*     * we only selectively sync' parts of this method, because we wish to wait for     * Statements to be destroyed without holding up the StatementCache by keeping     * the lock.     *     * THIS IS BECAUSE ORACLE DEADLOCKS IF A STATEMENT IS CLOSING AT THE SAME TIME AS     * ITS PARENT CONNECTION IS CLOSING. (THIS IS AN ORACLE BUG, AND I _HATE_ DRAMATICALLY     * COMPLICATING MY CODE TO AVOID IT.) Oh, okay. That's a bit overdone. Lots of drivers     * don't like the old behavior.     *     * we have a double-lock acqusition here -- we acquire a counter's lock, than our own.     * the other thread that contends the counter's lock is the async task thread in the      * destroy statement method. ensure that statement-destroying task does not acquire      * this' lock prior to requiring the counter's lock to avoid deadlock.     *     */    public void closeAll(Connection pcon) throws SQLException    {// 	System.err.println( this + ": closeAll( " + pcon + " )" );// 	new Exception("closeAll()").printStackTrace();	if (! this.isClosed())	    {		Set cSet = null;		synchronized(this)		    { cSet = cxnStmtMgr.statementSet( pcon ); }				if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)		    {			if (logger.isLoggable(MLevel.FINEST))			    {				logger.log(MLevel.FINEST, "ENTER METHOD: closeAll( " + pcon + " )! -- num_connections: " + 					   cxnStmtMgr.getNumConnectionsWithCachedStatements());				logger.log(MLevel.FINEST, "Set of statements for connection: " + cSet + (cSet != null ? "; size: " + cSet.size() : ""));			    }		    }				ChangeNotifyingSynchronizedIntHolder counter = new ChangeNotifyingSynchronizedIntHolder(0, true);		synchronized ( counter )		    {			if (cSet != null)			    {				//the removeStatement(...) removes from cSet, so we can't be iterating over cSet directly				Set stmtSet = new HashSet( cSet );				int sz = stmtSet.size();				//System.err.println("SIZE FOR CONNECTION SET: " + stmtSet.size());				for (Iterator ii = stmtSet.iterator(); ii.hasNext(); )				    {					Object stmt = ii.next();										synchronized ( this )					    { removeStatement( stmt, true, counter ); }				    }				try				    {					while (counter.getValue() < sz) 					    {						//System.err.println( "counter.getValue(): " + counter.getValue() + "; sz: " + sz );						counter.wait();					    }					//System.err.println( "FINAL: counter.getValue(): " + counter.getValue() + "; sz: " + sz );				    }				catch (InterruptedException e)				    {					if (logger.isLoggable(MLevel.WARNING))					    logger.warning("Unexpected interupt(). [A thread closing all Statements for a Connection in a Statement cache" +							   " will no longer wait for all Statements to close, but will move on and let them close() asynchronously." +							   " This is harmless in general, but may lead to a transient deadlock (which the thread pool will notice " +							   " and resolve) under some database drivers.]");				    }			    }		    }		if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX)		    {			if (logger.isLoggable(MLevel.FINEST))			    logger.finest("closeAll(): " + statsString());		    }	    }// 	else// 	    {// 		if (logger.isLoggable(MLevel.FINE))// 		    logger.log(MLevel.FINE, // 			       this + ":  call to closeAll() when statment cache is already closed! [not harmful! debug only!]", // 			       new Exception("DUPLICATE CLOSE DEBUG STACK TRACE."));// 	    }    }    public synchronized void close() 	throws SQLException    {	//System.err.println( this + ": close()" );	if (! isClosed())	    {		for (Iterator ii = stmtToKey.keySet().iterator(); ii.hasNext(); )		    synchronousDestroyStatement( ii.next() );				cxnStmtMgr       = null;		stmtToKey        = null;		keyToKeyRec      = null;		checkedOut       = null;		stmt_count       = -1;	    }	else	    {		if (logger.isLoggable(MLevel.FINE))		    logger.log(MLevel.FINE, this + ": duplicate call to close() [not harmful! -- debug only!]", new Exception("DUPLICATE CLOSE DEBUG STACK TRACE."));	    }    }    public synchronized boolean isClosed()    { return cxnStmtMgr == null; }    /* non-public methods that needn't be called with this' lock below */         private void destroyStatement( final Object pstmt )    { destroyStatement( pstmt, null ); }    /*     * ORACLE BUG WORKAROUND ( counter crap ) -- see closeAll(Connection c)     *     * NOTE: plan on reverting this method to fully sync'ed, no counter or waiting on counter      * involved if Oracle ever fixes their damned bug. See c3p0-0.9.0-pre5 for last simpler     * version.     */    private void destroyStatement( final Object pstmt, final ChangeNotifyingSynchronizedIntHolder counter )    { 	Runnable r;	if (counter == null)	    {		r = new Runnable()		    {			public void run()			{ StatementUtils.attemptClose( (PreparedStatement) pstmt ); }		    };	    }	else	    {		r = new Runnable()		    {			// this method MUSTN'T try to obtain this' lock prior to obtaining the 			// counter's lock, or a potential deadlock may result. 			//			// See closeAll(Connection c) comments.			public void run()			{ 			    synchronized( counter )				{				    StatementUtils.attemptClose( (PreparedStatement) pstmt ); 				    counter.increment();				}			}		    };	    }	blockingTaskAsyncRunner.postRunnable(r);    }    private void synchronousDestroyStatement( final Object pstmt )    { StatementUtils.attemptClose( (PreparedStatement) pstmt ); }    /* end non-public methods that needn't be called with this' lock */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久久免费一区二区| 一区二区三区产品免费精品久久75 | 日本不卡的三区四区五区| 亚洲综合色网站| 亚洲国产日韩av| 亚洲综合色视频| 亚洲第一二三四区| 午夜日韩在线电影| 日韩精品一二三四| 免费在线成人网| 精品一区二区三区av| 久久99国产精品尤物| 国产麻豆精品theporn| 国产美女一区二区三区| 成人综合婷婷国产精品久久蜜臀 | 日韩精品亚洲一区二区三区免费| 亚洲高清三级视频| 美女www一区二区| 国产自产高清不卡| 波多野结衣视频一区| 色乱码一区二区三区88| 欧美日韩国产免费一区二区| 欧美一区二区三区视频在线观看| 日韩三级.com| 亚洲国产精品二十页| 亚洲色欲色欲www| 亚洲成av人片在线观看无码| 欧美aa在线视频| 大美女一区二区三区| 一本大道av一区二区在线播放| 欧美日产在线观看| 国产亚洲自拍一区| 一区二区三区四区av| 日产欧产美韩系列久久99| 国产精品一二三在| 日本丶国产丶欧美色综合| 91精品国产色综合久久不卡电影| 精品久久久久久久久久久久包黑料| 国产精品人成在线观看免费| 亚洲一区二区三区四区在线免费观看| 日韩成人精品在线观看| 国产成人8x视频一区二区| 在线免费一区三区| 精品久久人人做人人爰| 亚洲日穴在线视频| 日本va欧美va精品| 成人激情开心网| 欧美高清hd18日本| 国产精品久久毛片| 日韩av中文在线观看| 成人av网站在线观看免费| 精品视频一区三区九区| 久久久久国色av免费看影院| 伊人色综合久久天天人手人婷| 九九精品一区二区| 色8久久精品久久久久久蜜| www国产成人免费观看视频 深夜成人网 | 国产欧美日韩中文久久| 日日欢夜夜爽一区| 成人av动漫在线| 日韩三级视频在线观看| 亚洲激情一二三区| 国产一区二区女| 欧美日韩一区二区不卡| 国产精品进线69影院| 久久国产生活片100| 在线观看www91| 欧美激情一区三区| 韩国在线一区二区| 精品视频1区2区3区| 国产精品激情偷乱一区二区∴| 欧美aaaaaa午夜精品| 欧洲激情一区二区| 国产精品久久久久久户外露出| 美女精品自拍一二三四| 欧美日韩国产综合久久| 亚洲色图在线播放| 粉嫩嫩av羞羞动漫久久久 | 亚洲日本韩国一区| 粉嫩嫩av羞羞动漫久久久| 日韩精品中文字幕在线一区| 亚洲成a人在线观看| 91久久精品午夜一区二区| 国产精品视频看| 国产成人8x视频一区二区 | 香蕉成人啪国产精品视频综合网| 成人av电影在线| 国产日韩欧美精品综合| 国产一区二区成人久久免费影院| 在线播放日韩导航| 香蕉久久夜色精品国产使用方法 | 精品视频免费看| 亚洲一级二级在线| 欧美亚洲综合在线| 夜夜精品视频一区二区| 在线免费av一区| 亚洲精选视频免费看| 色婷婷亚洲精品| 一区二区国产盗摄色噜噜| 97aⅴ精品视频一二三区| 综合自拍亚洲综合图不卡区| 国产69精品久久久久777| 欧美高清在线一区| 粉嫩av一区二区三区在线播放 | 国产精品伊人色| 久久嫩草精品久久久精品| 国内精品伊人久久久久av一坑| 欧美大片在线观看一区二区| 久久精品国产免费| 久久伊人中文字幕| 国产精品一区二区无线| 日本一区二区三区电影| 成人av网址在线观看| 最新高清无码专区| 欧亚洲嫩模精品一区三区| 亚洲国产精品久久久久婷婷884| 欧美图区在线视频| 天天av天天翘天天综合网 | 亚洲欧洲日产国产综合网| 成人免费av在线| 亚洲精品写真福利| 欧美日韩中文字幕一区| 蜜臀av性久久久久蜜臀aⅴ流畅| 日韩美女主播在线视频一区二区三区| 国产在线精品一区二区三区不卡| 国产欧美一区二区精品性色 | 久久久久久久综合日本| 粉嫩aⅴ一区二区三区四区五区| 国产精品国产自产拍高清av王其| 91黄色免费观看| 日韩精品每日更新| 26uuu精品一区二区在线观看| 国产成人福利片| 亚洲资源中文字幕| 欧美大白屁股肥臀xxxxxx| 国产精品夜夜嗨| 一区二区三区在线影院| 91麻豆精品91久久久久同性| 国精产品一区一区三区mba视频| 国产精品久久影院| 欧美美女网站色| 国产精品自拍一区| 亚洲综合视频网| 久久久91精品国产一区二区精品| 日本韩国精品在线| 男女性色大片免费观看一区二区| 久久久99久久| 欧美影片第一页| 国产成人午夜精品5599| 亚洲一区在线观看网站| 久久精子c满五个校花| 欧美色精品天天在线观看视频| 国内外成人在线| 亚洲国产日产av| 亚洲国产精品成人综合| 538在线一区二区精品国产| 国产精品一卡二卡在线观看| 亚洲成a人片在线不卡一二三区 | 亚洲午夜激情av| 久久精品日产第一区二区三区高清版| 在线精品视频一区二区| 国产精品中文字幕日韩精品| 亚洲成a人片在线不卡一二三区| 国产精品天美传媒沈樵| 91麻豆精品国产| 在线免费观看一区| 成人av免费在线观看| 久久激情五月婷婷| 亚洲午夜电影在线| 亚洲欧洲在线观看av| 久久久久久久久97黄色工厂| 91精品久久久久久蜜臀| 色综合久久中文综合久久牛| 国产精品一区一区| 日本欧美加勒比视频| 亚洲久草在线视频| 欧美国产日韩a欧美在线观看| 日韩一区二区三区电影| 欧美在线不卡视频| 成人动漫中文字幕| 国产一区二区在线看| 秋霞电影一区二区| 午夜天堂影视香蕉久久| 亚洲人成7777| 国产精品久久二区二区| 国产亚洲欧美日韩俺去了| 日韩视频一区二区在线观看| 欧美三级日本三级少妇99| 一本到不卡免费一区二区| 国产98色在线|日韩| 黄页视频在线91| 麻豆国产欧美日韩综合精品二区| 亚洲成人精品一区| 亚洲午夜电影在线观看| 亚洲精品一卡二卡| 亚洲精品乱码久久久久久黑人| 中文字幕亚洲欧美在线不卡| 欧美韩日一区二区三区四区| 日本一区二区免费在线观看视频| 久久一夜天堂av一区二区三区|