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

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

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

?? java學習文檔
?? TXT
字號:
作者:sonymusic
email: sonymusic@china.com
日期:2001-5-17 11:37:22
//文件:PropertyManager.java

//這個類其實沒什么用了,可以去掉,但需要去掉前面幾個類中對這個類的引用。
package com.qingtuo.db.pool;

import java.util.*;
import java.io.*;

/**
 * Manages properties for the entire Jive system. Properties are merely
 * pieces of information that need to be saved in between server restarts.
 * <p>
 * At the moment, properties are stored in a Java Properties file. In a version
 * of Jive coming soon, the properties file format will move to XML. XML
 * properties will allow hierarchical property structures which may mean the
 * API of this class will have to change.
 * <p>
 * Jive properties are only meant to be set and retrevied by core Jive classes.
 * Therefore, skin writers should probably ignore this class.
 * <p>
 * This class is implemented as a singleton since many classloaders seem to
 * take issue with doing classpath resource loading from a static context.
 */
public class PropertyManager {

	private static PropertyManager manager = null;
	private static Object managerLock = new Object();
	private static String propsName = "/pcc_2000.properties";

	/**
	 * Returns a Jive property
	 *
	 * @param name the name of the property to return.
	 * @returns the property value specified by name.
	 */
	public static String getProperty(String name) {
		if (manager == null) {
			synchronized(managerLock) {
				if (manager == null) {
					String sysname=System.getProperty("os.name").toUpperCase();
					if(sysname.indexOf("WIN")!=-1){
						propsName=propsName2000;
					}
					else{
						propsName=propsNameLinux;
					}
					manager = new PropertyManager(propsName);
				}
			}
		}
		return manager.getProp(name);
	}

	/**
	 * Sets a Jive property.
	 *
	 * @param name the name of the property being set.
	 * @param value the value of the property being set.
	 */
	public static void setProperty(String name, String value) {
		if (manager == null) {
			synchronized(managerLock) {
				if (manager == null) {
					manager = new PropertyManager(propsName);
				}
			}
		}
		manager.setProp(name, value);
	}

	/**
	 * Returns true if the properties are readable. This method is mainly
	 * valuable at setup time to ensure that the properties file is setup
	 * correctly.
	 */
	public static boolean propertyFileIsReadable() {
		if (manager == null) {
			synchronized(managerLock) {
				if (manager == null) {
					manager = new PropertyManager(propsName);
				}
			}
		}
		return manager.propFileIsReadable();
	}

	/**
	 * Returns true if the properties are writable. This method is mainly
	 * valuable at setup time to ensure that the properties file is setup
	 * correctly.
	 */
	public static boolean propertyFileIsWritable() {
		if (manager == null) {
			synchronized(managerLock) {
				if (manager == null) {
					manager = new PropertyManager(propsName);
				}
			}
		}
		return manager.propFileIsWritable();
	}

	/**
	 * Returns true if the jive.properties file exists where the path property
	 * purports that it does.
	 */
	public static boolean propertyFileExists() {
		if (manager == null) {
			synchronized(managerLock) {
				if (manager == null) {
					manager = new PropertyManager(propsName);
				}
			}
		}
		return manager.propFileExists();
	}

	private Properties properties = null;
	private Object propertiesLock = new Object();
	private String resourceURI;

	/**
	 * Singleton access only.
	 */
	private PropertyManager(String resourceURI) {
		this.resourceURI = resourceURI;
	}
   
	/**
	 * Gets a Jive property. Jive properties are stored in jive.properties.
	 * The properties file should be accesible from the classpath. Additionally,
	 * it should have a path field that gives the full path to where the
	 * file is located. Getting properties is a fast operation.
	 */
	public String getProp(String name) {
		//If properties aren't loaded yet. We also need to make this thread
		//safe, so synchronize...
		if (properties == null) {
			synchronized(propertiesLock) {
				//Need an additional check
				if (properties == null) {
					loadProps();
				}
			}
		}
		return properties.getProperty(name);
	}

	/**
	 * Sets a Jive property. Because the properties must be saved to disk
	 * every time a property is set, property setting is relatively slow.
	 */
	public void setProp(String name, String value) {
		//Only one thread should be writing to the file system at once.
		synchronized (propertiesLock) {
			//Create the properties object if necessary.
			if (properties == null) {
				loadProps();
			}
			properties.setProperty(name, value);
			//Now, save the properties to disk. In order for this to work, the user
			//needs to have set the path field in the properties file. Trim
			//the String to make sure there are no extra spaces.
			String path = properties.getProperty("path").trim();
			OutputStream out = null;
			try {
				out = new FileOutputStream(path);
				properties.store(out, "jive.properties -- " + (new java.util.Date()));
			}
			catch (Exception ioe) {
				System.err.println("There was an error writing jive.properties to " + path + ". " +
					"Ensure that the path exists and that the Jive process has permission " +
					"to write to it -- " + ioe);
				ioe.printStackTrace();
			}
			finally {
				try {
					out.close();
				} catch (Exception e) { }
			}
		}
	}

	/**
	 * Loads Jive properties from the disk.
	 */
	private void loadProps() {
		properties = new Properties();
		InputStream in = null;
		try {
			in = getClass().getResourceAsStream(resourceURI);
			properties.load(in);
		}
		catch (IOException ioe) {
			System.err.println("Error reading Pcc properties" + ioe);
			ioe.printStackTrace();
		}
		finally {
			try {
				in.close();
			} catch (Exception e) { }
		}
	}

	/**
	 * Returns true if the properties are readable. This method is mainly
	 * valuable at setup time to ensure that the properties file is setup
	 * correctly.
	 */
	public boolean propFileIsReadable() {
		try {
			InputStream in = getClass().getResourceAsStream(resourceURI);
			return true;
		}
		catch (Exception e) {
			return false;
		}
	}

	/**
	 * Returns true if the jive.properties file exists where the path property
	 * purports that it does.
	 */
	public boolean propFileExists() {
		String path = getProp("path");
		File file = new File(path);
		if (file.isFile()) {
			return true;
		}
		else {
			return false;
		}
	}

	/**
	 * Returns true if the properties are writable. This method is mainly
	 * valuable at setup time to ensure that the properties file is setup
	 * correctly.
	 */
	public boolean propFileIsWritable() {
		String path = getProp("path");
		File file = new File(path);
		if (file.isFile()) {
			//See if we can write to the file
			if (file.canWrite()) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}
	}

	private static String propsName2000 = "/pcc_2000.properties";
	private static String propsNameLinux = "/pcc_linux.properties";
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人日日夜夜| 成人晚上爱看视频| 一区二区三区在线视频观看58 | 亚洲女人的天堂| 日韩毛片高清在线播放| 国产精品久久午夜| 午夜视频在线观看一区二区 | 免费观看在线综合色| 日韩福利视频网| 另类综合日韩欧美亚洲| 国内精品写真在线观看| 国产成人av电影在线播放| 成人性生交大片免费看中文 | 欧美精品一区视频| 国产欧美一区二区三区沐欲| 欧美国产激情一区二区三区蜜月| 国产精品毛片久久久久久| 亚洲男帅同性gay1069| 亚洲二区在线观看| 日韩二区三区四区| 国产91丝袜在线播放九色| 色婷婷综合久久久久中文一区二区| 91九色最新地址| 精品88久久久久88久久久| 日韩一区在线播放| 亚洲高清免费在线| 国产麻豆一精品一av一免费| 91在线无精精品入口| 欧美剧在线免费观看网站| 久久久噜噜噜久久人人看| 亚洲精品欧美在线| 久久超碰97人人做人人爱| 99精品久久99久久久久| 欧美不卡一二三| 亚洲精品自拍动漫在线| 国产精品18久久久久久久久久久久| 色综合天天性综合| 26uuu国产电影一区二区| 一区二区三区中文字幕电影 | 天堂资源在线中文精品| 国产精品1024久久| 欧美日韩1区2区| 国产精品久线观看视频| 精品无人码麻豆乱码1区2区 | 亚洲人快播电影网| 同产精品九九九| 成人性色生活片| 欧美一区二区在线观看| 亚洲欧美另类图片小说| 韩国欧美国产一区| 欧美丰满少妇xxxxx高潮对白| 欧美激情一区二区三区全黄 | 国产一区二区三区最好精华液| 日韩久久精品一区| 亚洲欧美偷拍三级| 成人一级片网址| 精品国产一区二区在线观看| 视频在线观看91| 欧美日韩色一区| 一区二区三区免费观看| 不卡视频免费播放| 欧美激情一区二区三区| 国产在线精品一区二区夜色| 日韩视频123| 美女一区二区三区| 日韩一级高清毛片| 美女视频黄频大全不卡视频在线播放| 欧美系列亚洲系列| 亚洲成人免费在线观看| 欧美日韩一区久久| 亚洲成在人线在线播放| 欧美日韩日日夜夜| 日韩激情视频在线观看| 欧美日韩电影一区| 日韩经典一区二区| 日韩欧美一级二级| 久久国产成人午夜av影院| 日韩免费看网站| 久久国产尿小便嘘嘘尿| www激情久久| 国产69精品一区二区亚洲孕妇| 欧美精品一区二区久久久| 国产精品77777| 国产精品免费aⅴ片在线观看| 波多野结衣中文字幕一区二区三区 | 欧美色手机在线观看| 亚洲美女在线国产| 欧美日本免费一区二区三区| 亚洲777理论| 欧美成人aa大片| www.日韩在线| 亚洲一级二级在线| 欧美电影免费观看高清完整版| 久久超碰97中文字幕| 国产欧美日韩在线| 色婷婷av一区| 蜜桃在线一区二区三区| 国产精品午夜久久| 91国产精品成人| 久久国产人妖系列| 中文字幕一区二区三区精华液| 一本大道av一区二区在线播放| 天涯成人国产亚洲精品一区av| 精品免费视频.| 91丨九色丨尤物| 秋霞成人午夜伦在线观看| 日韩精品一区二区三区在线观看| 国产精品综合在线视频| 亚洲最色的网站| 久久九九99视频| 精品视频免费看| 成人精品高清在线| 免费成人在线影院| 亚洲人成伊人成综合网小说| 日韩欧美成人午夜| 色婷婷综合久久| 欧美无砖砖区免费| 久久99精品国产麻豆婷婷| 亚洲日本一区二区三区| 欧美精品久久一区二区三区| 国产河南妇女毛片精品久久久| 午夜视频在线观看一区二区三区| 国产欧美日韩不卡免费| 欧美精品一级二级三级| 97久久超碰国产精品| 国产精品一区二区三区99| 亚洲国产va精品久久久不卡综合| 日本一二三四高清不卡| 精品少妇一区二区三区视频免付费| 欧洲一区二区三区免费视频| 国产精品77777| 久久成人麻豆午夜电影| 视频一区二区欧美| 亚洲精品视频在线| 亚洲人成在线观看一区二区| 中文字幕不卡的av| 久久免费看少妇高潮| 日韩一级黄色片| 51久久夜色精品国产麻豆| 欧美日韩精品电影| 色婷婷激情综合| 日本韩国欧美三级| 成人av小说网| 99热这里都是精品| av不卡免费在线观看| 成人免费视频网站在线观看| 国产伦精品一区二区三区免费迷 | 狠狠v欧美v日韩v亚洲ⅴ| 污片在线观看一区二区| 香蕉加勒比综合久久| 亚洲一区二区三区美女| 亚洲电影视频在线| 午夜精品久久久久久久蜜桃app| 有码一区二区三区| 亚洲一区二区av电影| 三级欧美韩日大片在线看| 五月天欧美精品| 六月婷婷色综合| 国产主播一区二区| 丁香网亚洲国际| 色综合欧美在线视频区| 欧美视频在线不卡| 日韩三级视频在线看| 精品国产乱码久久| 国产精品久久看| 一个色妞综合视频在线观看| 亚洲高清久久久| 美女免费视频一区| 国产成人免费网站| 91在线一区二区| 欧美疯狂性受xxxxx喷水图片| 91精品国产入口| 国产精品美女一区二区三区 | 亚洲制服丝袜av| 日韩成人精品在线观看| 国产真实精品久久二三区| 不卡的电影网站| 9191久久久久久久久久久| 欧美大片顶级少妇| 国产精品福利影院| 天天射综合影视| 成人性生交大片免费看中文| 在线视频欧美区| 欧美成人精品二区三区99精品| 国产无一区二区| 视频一区国产视频| 成人深夜视频在线观看| 欧美日韩免费高清一区色橹橹| 日韩一级完整毛片| 亚洲乱码国产乱码精品精的特点 | 最新欧美精品一区二区三区| 一区二区三区精品视频在线| 久久黄色级2电影| 91国偷自产一区二区三区观看| 精品少妇一区二区三区日产乱码| 亚洲欧美另类久久久精品2019| 蜜桃一区二区三区在线观看| 色婷婷久久综合| 国产日韩欧美亚洲| 日本不卡不码高清免费观看 |