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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dbconnectiondefaultpool.java

?? 這是學(xué)習(xí)Java必須讀懂兩套源代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號(hào):
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL YASNA.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.database;

import java.sql.*;
import java.util.*;
import java.io.*;
import java.text.*;
import java.util.Date;
import com.Yasna.forum.*;

/**
 * Default Yazd connection provider. It uses the excellent connection pool
 * available from http://www.javaexchange.com. This connection provider is a
 * a good choice unless you can use a container-managed one.
 */
public class DbConnectionDefaultPool extends DbConnectionProvider {

    private static final String NAME = "Default Connection Pool";
    private static final String DESCRIPTION = "The default connection provider "
        + "that uses the connection pool from javaexchange.com. It works with "
        + "almost any database setup, is customizable, and offers good performance. "
        + "Use this connection provider unless you have your own or can use a "
        + "container managed connection pool.";
    private static final String AUTHOR = "Yazd.Yasna.com";
    private static final int MAJOR_VERSION = 1;
    private static final int MINOR_VERSION = 0;
    private static final boolean POOLED = true;

    private ConnectionPool connectionPool = null;
    private Properties props;
    private Properties propDescriptions;

    private Object initLock = new Object();

    public DbConnectionDefaultPool() {
        //this.manager = manager;
        props = new Properties();
        propDescriptions = new Properties();
        //Initialize all property values
        initializeProperties();
        //Load any existing property values
        loadProperties();
    }

    /**
     * Returns a database connection.
     */
    public Connection getConnection() {
        if (connectionPool == null) {
            //block until the init has been done
            synchronized(initLock) {
                //if still null, something has gone wrong
                if (connectionPool == null) {
                    System.err.println("Warning: DbConnectionDefaultPool.getConnection() was " +
                    "called when the internal pool has not been initialized.");
                    return null;
                }
            }
        }
        return new ConnectionWrapper(connectionPool.getConnection(), connectionPool);
    }

    /**
     * Starts the pool.
     */
    protected void start() {
        //acquire lock so that no connections can be returned.
        synchronized (initLock) {
            //Get properties
            String driver = props.getProperty("driver");
            String server = props.getProperty("server");
            String username = props.getProperty("username");
            String password = props.getProperty("password");
            int minConnections = 0, maxConnections = 0;
            double connectionTimeout = 0.0;
            try {
                minConnections = Integer.parseInt(props.getProperty("minConnections"));
                maxConnections = Integer.parseInt(props.getProperty("maxConnections"));
                connectionTimeout = Double.parseDouble(props.getProperty("connectionTimeout"));
            }
            catch (Exception e) {
                System.err.println("Error: could not parse default pool properties. " +
                    "Make sure the values exist and are correct.");
                e.printStackTrace();
                return;
            }
            String logPath = props.getProperty("logPath");

            try {
                connectionPool = new ConnectionPool(driver, server, username, password,
                    minConnections, maxConnections, logPath, connectionTimeout);
            }
            catch (IOException ioe) {
                System.err.println("Error starting DbConnectionDefaultPool: " + ioe);
                ioe.printStackTrace();
            }
        }
    }

    /**
     * Restarts the pool to take into account any property changes.
     */
    protected void restart() {
        //Kill off pool.
        destroy();
        //Reload properties.
        loadProperties();
        //Start a new pool.
        start();
    }

    /**
     * Destroys the connection pool.
     */
    protected void destroy() {
        if (connectionPool != null) {
            try {
                connectionPool.destroy(1);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
        //Release reference to connectionPool
        connectionPool = null;
    }

    /**
     * Returns the value of a property of the connection provider.
     *
     * @param name the name of the property.
     * @returns the value of the property.
     */
    public String getProperty(String name) {
        return (String)props.get(name);
    }

    /**
     * Returns the description of a property of the connection provider.
     *
     * @param name the name of the property.
     * @return the description of the property.
     */
    public String getPropertyDescription(String name) {
        return (String)propDescriptions.get(name);
    }

    /**
     * Returns an enumeration of the property names for the connection provider.
     */
    public Enumeration propertyNames() {
        return props.propertyNames();
    }

    /**
     * Sets a property of the connection provider. Each provider has a set number
     * of properties that are determined by the author. Trying to set a non-
     * existant property will result in an IllegalArgumentException.
     *
     * @param name the name of the property to set.
     * @param value the new value for the property.
     *
     */
    public void setProperty(String name, String value) {
        props.put(name, value);
        saveProperties();
    }

    /**
     * Give default values to all the properties and descriptions.
     */
    private void initializeProperties() {
        props.put("driver","");
        props.put("server","");
        props.put("username","");
        props.put("password","");
        props.put("minConnections","");
        props.put("maxConnections","");
        props.put("logPath","");
        props.put("connectionTimeout","");

        propDescriptions.put("driver","JDBC driver. e.g. 'oracle.jdbc.driver.OracleDriver'");
        propDescriptions.put("server","JDBC connect string. e.g. 'jdbc:oracle:thin:@203.92.21.109:1526:orcl'");
        propDescriptions.put("username","Database username. e.g. 'Scott'");
        propDescriptions.put("password","Database password. e.g. 'Tiger'");
        propDescriptions.put("minConnections","Minimum # of connections to start with in pool. Three is the recommended minimum");
        propDescriptions.put("maxConnections","Maximum # of connections in dynamic pool. Fifteen should give good performance for an average load.");
        propDescriptions.put("logPath","Absolute path name for log file. e.g. 'c:\\logs\\yazdDbLog.log'");
        propDescriptions.put("connectionTimeout","Time in days between connection resets. e.g. '.5'");
    }

    /**
     * Load whatever properties that already exist.
     */
    private void loadProperties() {
        String driver = PropertyManager.getProperty("DbConnectionDefaultPool.driver");
        String server = PropertyManager.getProperty("DbConnectionDefaultPool.server");
        String username = PropertyManager.getProperty("DbConnectionDefaultPool.username");
        String password = PropertyManager.getProperty("DbConnectionDefaultPool.password");
        String minConnections = PropertyManager.getProperty("DbConnectionDefaultPool.minConnections");
        String maxConnections = PropertyManager.getProperty("DbConnectionDefaultPool.maxConnections");
        String logPath = PropertyManager.getProperty("DbConnectionDefaultPool.logPath");
        String connectionTimeout = PropertyManager.getProperty("DbConnectionDefaultPool.connectionTimeout");

        if (driver != null) {  props.setProperty("driver", driver);  }
        if (server != null) {  props.setProperty("server", server);  }
        if (username != null) {  props.setProperty("username", username);  }
        if (password != null) {  props.setProperty("password", password);  }
        if (minConnections != null) {  props.setProperty("minConnections", minConnections);  }
        if (maxConnections != null) {  props.setProperty("maxConnections", maxConnections);  }
        if (logPath != null) {  props.setProperty("logPath", logPath);  }
        if (connectionTimeout != null) {  props.setProperty("connectionTimeout", connectionTimeout);  }
    }

    private void saveProperties() {
        PropertyManager.setProperty("DbConnectionDefaultPool.driver", props.getProperty("driver"));
        PropertyManager.setProperty("DbConnectionDefaultPool.server", props.getProperty("server"));
        PropertyManager.setProperty("DbConnectionDefaultPool.username", props.getProperty("username"));
        PropertyManager.setProperty("DbConnectionDefaultPool.password", props.getProperty("password"));
        PropertyManager.setProperty("DbConnectionDefaultPool.minConnections", props.getProperty("minConnections"));
        PropertyManager.setProperty("DbConnectionDefaultPool.maxConnections", props.getProperty("maxConnections"));
        PropertyManager.setProperty("DbConnectionDefaultPool.logPath", props.getProperty("logPath"));
        PropertyManager.setProperty("DbConnectionDefaultPool.connectionTimeout", props.getProperty("connectionTimeout"));
    }

    /**
     * DbConnectionBroker
     * @version 1.0.11 12/7/99
     * @author Marc A. Mnich
     *
     * ----------------------------------------
     * Modified June 18, 2000 by Matt Tucker
     *   Changes:
     *     - New package name, class name to make it nice to embed as
     *        an internal class.
     *     - Source code reformatting.
     *     - Added more error handling code in constructor, createConn method
     *       so that more information is given to Yazd users.
     * DbConnectionBroker rules! Download it from javaexchange.com
     * ----------------------------------------

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久激情综合网| 欧美性猛片xxxx免费看久爱| 亚洲日本欧美天堂| 欧美日韩亚洲丝袜制服| 国产盗摄一区二区三区| 亚洲午夜久久久| 2021久久国产精品不只是精品| 色先锋久久av资源部| 成人午夜视频免费看| 日韩精品电影在线| 亚洲精品国产品国语在线app| 亚洲精品一区二区三区四区高清| 欧美视频在线一区| 91色在线porny| 成人一区二区三区中文字幕| 美女国产一区二区| 亚洲国产精品久久人人爱| 中文一区在线播放| 国产视频一区二区三区在线观看 | 91女神在线视频| 丁香桃色午夜亚洲一区二区三区| 免费视频最近日韩| 日韩国产一区二| 午夜精品123| 性感美女极品91精品| 午夜精品久久久久久久久久久| 亚洲视频在线观看三级| 亚洲特黄一级片| 亚洲精品videosex极品| 亚洲日本一区二区| 亚洲毛片av在线| 亚洲小少妇裸体bbw| 视频在线观看国产精品| 美女视频黄 久久| 国产乱码字幕精品高清av| 国产一区二区三区精品视频| 国产精品2024| 欧美午夜免费电影| 日韩精品一区二区三区视频在线观看| 日韩亚洲国产中文字幕欧美| 久久精品网站免费观看| 国产精品白丝在线| 日韩高清一区在线| 成人综合在线观看| 欧美性大战久久久| 精品国精品国产| 亚洲精品老司机| 国产综合久久久久影院| 色综合色狠狠综合色| 精品国产乱码久久久久久浪潮| 国产精品久久精品日日| 久久99久国产精品黄毛片色诱| 成人国产精品免费观看视频| 欧美人妇做爰xxxⅹ性高电影| 精品久久国产97色综合| 中文字幕一区二区在线播放| 日韩av电影天堂| 99久久久精品免费观看国产蜜| 欧美午夜寂寞影院| 日本一区二区三区dvd视频在线| 亚洲狼人国产精品| 黄网站免费久久| 欧美自拍丝袜亚洲| 国产精品乱码一区二三区小蝌蚪| 亚洲成人7777| 欧美自拍丝袜亚洲| 国产精品久久国产精麻豆99网站| 丝袜美腿亚洲色图| 日本道在线观看一区二区| 精品电影一区二区| 奇米影视一区二区三区小说| av一二三不卡影片| 精品视频1区2区| 亚洲成a人片在线观看中文| 岛国av在线一区| 久久久久国产精品人| 奇米影视一区二区三区小说| 欧美在线免费观看视频| 亚洲日本免费电影| av成人动漫在线观看| 日本一区二区高清| 粉嫩久久99精品久久久久久夜| 欧美猛男超大videosgay| 亚洲欧美综合色| 91农村精品一区二区在线| 最新日韩av在线| 亚洲一区二区高清| 欧美视频在线观看一区二区| 又紧又大又爽精品一区二区| 在线免费观看日韩欧美| 亚洲成人综合在线| 日韩欧美国产精品| 国产成人av影院| 亚洲美女在线一区| 欧美一区二区三区四区久久| 天天操天天干天天综合网| 欧美一级国产精品| 国产一区不卡视频| 国产精品国产三级国产aⅴ中文 | 国产在线不卡一卡二卡三卡四卡| 2017欧美狠狠色| 99免费精品在线观看| 天使萌一区二区三区免费观看| 日韩精品在线看片z| 一区二区视频在线看| 色欧美片视频在线观看 | 国产一区激情在线| 91丨porny丨中文| xf在线a精品一区二区视频网站| 五月激情综合色| 欧美一区二区三区公司| 亚洲婷婷国产精品电影人久久| 欧美日韩色一区| 精品一区二区在线观看| 一区二区三区四区av| 欧美xxxx在线观看| 欧洲一区在线观看| 从欧美一区二区三区| 亚洲一区二区精品久久av| 国产三级久久久| 欧美久久一二三四区| 99热这里都是精品| 国产另类ts人妖一区二区| 视频一区二区中文字幕| 久久综合九色综合97婷婷| 91搞黄在线观看| 91免费观看在线| 国产一区二区三区免费在线观看 | 欧美日韩激情在线| 9i在线看片成人免费| 国产毛片精品视频| 日韩av在线播放中文字幕| 亚欧色一区w666天堂| 国产天堂亚洲国产碰碰| 久久久www成人免费无遮挡大片| 欧美色手机在线观看| 色狠狠综合天天综合综合| www.综合网.com| 91蝌蚪porny九色| 欧美在线不卡视频| 在线一区二区视频| 欧美军同video69gay| 日韩欧美成人一区| 91蜜桃视频在线| 欧美蜜桃一区二区三区| 欧美日韩三级在线| 精品久久久久久最新网址| 国产午夜三级一区二区三| 国产三级三级三级精品8ⅰ区| 国产女主播一区| 亚洲乱码国产乱码精品精可以看| 国产精品毛片久久久久久| 亚洲大尺度视频在线观看| 久久国产精品区| 丁香激情综合国产| 在线观看亚洲精品| 91精品视频网| www亚洲一区| 亚洲欧洲成人自拍| 亚洲摸摸操操av| 国产成人在线电影| 欧美美女一区二区三区| 26uuu亚洲婷婷狠狠天堂| 最新不卡av在线| 午夜av一区二区三区| 国产凹凸在线观看一区二区| 欧美日韩国产影片| 午夜国产精品一区| hitomi一区二区三区精品| 欧美一区二区网站| 亚洲激情综合网| av成人动漫在线观看| 精品欧美一区二区久久| 国产精品久久久久永久免费观看| 国产成a人亚洲精| 久久综合色鬼综合色| 五月激情综合网| 91论坛在线播放| 综合亚洲深深色噜噜狠狠网站| 久久国产精品免费| 精品国产免费人成在线观看| 一区二区三区精品视频| 99精品欧美一区二区三区小说 | 色婷婷综合视频在线观看| 久久久久久久久久久久电影 | 久久久久久9999| 国产曰批免费观看久久久| 欧美一二区视频| 青青草97国产精品免费观看 | 久热成人在线视频| 精品剧情在线观看| 国产成人精品免费网站| 国产精品免费视频网站| av资源网一区| 亚洲影视在线播放| 欧美日韩高清一区二区| 青青草伊人久久| 国产喂奶挤奶一区二区三区| 一本久久综合亚洲鲁鲁五月天 | 94色蜜桃网一区二区三区|