<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    VIRGIN FOREST OF JAVA
    不要埋頭苦干,要學習,學習,再學習。。。。。
    powered by R.Zeus

    ?public void closeConnection(Connection conn) throws SQLException {

    ??if ( log.isDebugEnabled() ) checkedOut--;

    //synchronized?pool to avoid concurrence error.??
    synchronized (pool) {
    ???int currentSize = pool.size();
    ???if ( currentSize < poolSize ) {
    ????if ( log.isTraceEnabled() ) log.trace("returning connection to pool, pool size: " + (currentSize + 1) );

    //add to pool
    ??
    ????pool.add(conn);
    ????return;
    ???}
    ??}

    ??log.debug("closing JDBC connection");

    ??conn.close();

    ?}


    ?public Connection getConnection() throws SQLException {

    ??if ( log.isTraceEnabled() ) log.trace( "total checked-out connections: " + checkedOut );

    //synchronized?pool to avoid concurrence error ???
    ?synchronized (pool) {
    ???if ( !pool.isEmpty() ) {

    //if the pool is not empty,return connection from the pool??

    ????
    ????int last = pool.size() - 1;
    ????if ( log.isTraceEnabled() ) {
    ?????log.trace("using pooled JDBC connection, pool size: " + last);
    ?????checkedOut++;
    ????}
    ????Connection pooled = (Connection) pool.remove(last);
    ????if (isolation!=null) pooled.setTransactionIsolation( isolation.intValue() );
    ????if ( pooled.getAutoCommit()!=autocommit ) pooled.setAutoCommit(autocommit);
    ????return pooled;
    ???}
    ??}

    ??log.debug("opening new JDBC connection");
    //create new connection.
    ??Connection conn = DriverManager.getConnection(url, connectionProps);
    ??if (isolation!=null) conn.setTransactionIsolation( isolation.intValue() );
    ??if ( conn.getAutoCommit()!=autocommit ) conn.setAutoCommit(autocommit);

    ??if ( log.isDebugEnabled() ) {
    ???log.debug( "created connection to: " + url + ", Isolation Level: " + conn.getTransactionIsolation() );
    ??}
    ??if ( log.isTraceEnabled() ) checkedOut++;

    ??return conn;
    ?}


    so you can see that when the connection will close,it actually not close and add to the pool if the pool size is not full.

    in other way , we can?firstly create a number of connection in the pool and when the pool is used out then create new connection to the call.

    I will see the C3P0ConnectionProvider next.

    A connection provider that uses java.sql.DriverManager. This provider
    ?also implements a very rudimentary connection pool.

    Note that you have to copy the required library into your classpath and use different connection pooling settings if you want to use a production-quality third party JDBC pooling software.


    posted on 2006-11-08 12:23 R.Zeus 閱讀(678) 評論(0)  編輯  收藏 所屬分類: Hibernate
    主站蜘蛛池模板: 国产精品亚洲二区在线观看 | 看免费毛片天天看| av大片在线无码免费| 91精品国产亚洲爽啪在线影院 | 日韩av无码久久精品免费| 亚洲国产成人片在线观看无码 | 51在线视频免费观看视频| 亚洲最新视频在线观看| 久久国产色AV免费看| 亚洲国产成人资源在线软件| 国产精品久久久久免费a∨ | 日韩在线观看免费| 国产精品亚洲精品日韩已方| 成在人线av无码免费高潮水 | 在线观看成人免费视频不卡| 亚洲中文无码永久免费| 国产色爽免费视频| 一本岛v免费不卡一二三区| 亚洲精品无码久久千人斩| 91精品视频在线免费观看| 亚洲fuli在线观看| 国产免费AV片无码永久免费| eeuss影院ss奇兵免费com| 久久久久亚洲精品无码系列| 亚洲三级高清免费| 美女被暴羞羞免费视频| 亚洲Av无码精品色午夜| 69天堂人成无码麻豆免费视频| 亚洲国产AV无码一区二区三区| 亚洲av日韩av欧v在线天堂| 国产无遮挡裸体免费视频在线观看 | 16女性下面无遮挡免费| 亚洲中文字幕无码av| 亚洲午夜激情视频| 7x7x7x免费在线观看| 青青青亚洲精品国产| 久久精品国产精品亚洲艾草网| 国产99视频精品免费观看7| 午夜成人无码福利免费视频| 精品亚洲成a人片在线观看| 破了亲妺妺的处免费视频国产|