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

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

?? dbconnectiondefaultpool.java

?? Jvie論壇的程序
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/**
 * 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
     * ----------------------------------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区主播在线| 久久久99精品免费观看| 亚洲不卡一区二区三区| 欧美综合亚洲图片综合区| 洋洋av久久久久久久一区| 欧美日韩和欧美的一区二区| 视频一区二区中文字幕| 精品国产一二三区| 成人免费av在线| 亚洲综合区在线| 91精品国产91久久久久久最新毛片| 麻豆成人久久精品二区三区红 | 欧美视频在线播放| 日韩高清欧美激情| 久久先锋影音av鲁色资源 | 色网综合在线观看| 五月激情综合婷婷| 久久奇米777| 91黄色在线观看| 日本午夜一本久久久综合| 久久久亚洲精品石原莉奈| 成人的网站免费观看| 午夜精品一区二区三区免费视频| 日韩精品一区二区三区swag| 成人动漫一区二区三区| 偷拍与自拍一区| 亚洲国产精品激情在线观看| 99久久伊人精品| 国产欧美一区二区精品久导航| 亚洲免费观看高清完整版在线 | 日韩理论电影院| 国产精品全国免费观看高清| 日本精品一区二区三区四区的功能| 麻豆国产欧美日韩综合精品二区 | 亚洲精品免费电影| 精品不卡在线视频| 欧美色爱综合网| 成人免费视频caoporn| 日本人妖一区二区| 亚洲综合色噜噜狠狠| 国产网站一区二区| 欧美日韩中文字幕一区| 岛国精品在线观看| 蜜桃av一区二区三区电影| 亚洲免费看黄网站| 国产午夜精品一区二区三区嫩草| 91精品午夜视频| 91老司机福利 在线| 国产乱码精品一品二品| 日韩国产高清在线| 亚洲电影视频在线| 亚洲天堂网中文字| 久久精品亚洲精品国产欧美 | 亚洲欧美色一区| 久久久国产一区二区三区四区小说| 午夜精品一区在线观看| 亚洲免费观看高清完整版在线| 久久亚区不卡日本| 日韩视频永久免费| 欧美视频一区二| 色偷偷一区二区三区| 岛国精品在线播放| 国产精品911| 国产一区不卡精品| 久久99精品国产麻豆婷婷洗澡| 午夜久久久影院| 性久久久久久久久久久久| 亚洲青青青在线视频| 亚洲天堂免费在线观看视频| 国产精品免费aⅴ片在线观看| 国产视频一区在线观看| 久久久无码精品亚洲日韩按摩| 日韩欧美一级精品久久| 日韩一级成人av| 91麻豆精品国产| 欧美一区二区在线免费播放| 欧美日韩日日骚| 欧美肥胖老妇做爰| 欧美精品一级二级| 欧美精品777| 日韩欧美一二三| 精品国产免费一区二区三区香蕉| 日韩精品中午字幕| 久久影院视频免费| 国产精品网站导航| 亚洲精选在线视频| 亚洲成av人综合在线观看| 三级久久三级久久| 久久国产精品第一页| 国产盗摄视频一区二区三区| www.色综合.com| 在线观看欧美日本| 欧美电视剧免费全集观看| 国产午夜精品美女毛片视频| 国产精品久久久久aaaa樱花| 亚洲美女免费在线| 青草av.久久免费一区| 精品一区二区三区久久| 国产成a人亚洲精| 在线免费精品视频| 日韩精品一区二区三区四区视频| 久久久影视传媒| 亚洲最大色网站| 久久av资源网| 色综合 综合色| 欧美一级在线免费| 国产欧美一区二区精品婷婷| 亚洲一区免费观看| 国内精品国产成人| 色综合天天狠狠| 日韩精品中文字幕在线一区| 日韩一区在线播放| 男人操女人的视频在线观看欧美| 高清av一区二区| 欧美日韩1234| 国产精品天干天干在观线| 亚洲成人手机在线| 国产成人午夜精品影院观看视频 | 国模套图日韩精品一区二区| 99国产精品国产精品久久| 欧美一三区三区四区免费在线看 | 另类综合日韩欧美亚洲| 成人激情免费电影网址| 久久er精品视频| 91在线云播放| 精品福利视频一区二区三区| 日韩理论片在线| 国产一区二区三区香蕉| 欧美性欧美巨大黑白大战| 久久久久久久综合日本| 日韩高清电影一区| 色噜噜久久综合| 国产蜜臀97一区二区三区| 婷婷久久综合九色国产成人| caoporm超碰国产精品| 欧美videofree性高清杂交| 亚洲在线视频一区| 成人性生交大合| 精品播放一区二区| 日韩电影一区二区三区四区| 91精品福利视频| 国产精品久久久久久久久晋中| 另类的小说在线视频另类成人小视频在线| 91一区二区在线观看| 国产日本一区二区| 久久成人av少妇免费| 91麻豆精品国产91久久久久久久久| 亚洲欧美另类小说视频| 东方aⅴ免费观看久久av| 国产欧美日韩不卡免费| 国内精品视频666| 一区二区三区久久| 亚洲最快最全在线视频| 国产99精品视频| 精品国产伦一区二区三区观看方式 | caoporn国产精品| 久久久精品日韩欧美| 奇米精品一区二区三区在线观看| 91高清在线观看| 一区二区中文字幕在线| 9l国产精品久久久久麻豆| 国产亲近乱来精品视频| 国产馆精品极品| 国产日韩精品久久久| 国产精品白丝av| 久久一区二区三区四区| 国产精品综合在线视频| 国产亚洲欧美在线| 国产1区2区3区精品美女| 欧美韩国日本综合| 成年人网站91| 91在线国产福利| 国产一区二区三区视频在线播放 | 26uuu精品一区二区在线观看| 亚洲国产精品二十页| 日韩1区2区3区| 制服丝袜亚洲色图| 久久激情五月婷婷| 精品免费一区二区三区| 国产麻豆午夜三级精品| 中文一区一区三区高中清不卡| 成人福利视频网站| 国产精品美女久久久久高潮| 色综合久久综合| 亚洲午夜视频在线观看| 制服.丝袜.亚洲.另类.中文| 久久国产精品99精品国产| 国产亚洲精品bt天堂精选| 91色综合久久久久婷婷| 午夜久久久久久| 欧美精品一区二| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 亚洲精品一线二线三线| 麻豆免费精品视频| 亚洲一卡二卡三卡四卡无卡久久 | 91 com成人网| 国产一区二区三区精品视频| 国产精品丝袜在线| 欧美亚洲动漫制服丝袜| 老汉av免费一区二区三区|