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

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

?? replicationconnection.java

?? mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序
?? JAVA
字號:
/* Copyright (C) 2004 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as  published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL  as it is applied to this software. View the full text of the  exception in file EXCEPTIONS-CONNECTOR-J in the directory of this  software distribution. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package com.mysql.jdbc;import java.sql.CallableStatement;import java.sql.DatabaseMetaData;import java.sql.PreparedStatement;import java.sql.SQLException;import java.sql.SQLWarning;import java.sql.Savepoint;import java.sql.Statement;import java.util.Map;import java.util.Properties;/** * Connection that opens two connections, one two a replication master, and * another to one or more slaves, and decides to use master when the connection * is not read-only, and use slave(s) when the connection is read-only. *  * @version $Id: ReplicationConnection.java,v 1.1.2.1 2005/05/13 18:58:38 *          mmatthews Exp $ */public class ReplicationConnection implements java.sql.Connection, PingTarget {	private Connection currentConnection;	private Connection masterConnection;	private Connection slavesConnection;	public ReplicationConnection(Properties masterProperties,			Properties slaveProperties) throws SQLException {		Driver driver = new Driver();		StringBuffer masterUrl = new StringBuffer("jdbc:mysql://");        StringBuffer slaveUrl = new StringBuffer("jdbc:mysql://");        String masterHost = masterProperties        	.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);                if (masterHost != null) {        	masterUrl.append(masterHost);        }         String slaveHost = slaveProperties        	.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);        	        if (slaveHost != null) {        	slaveUrl.append(slaveHost);        }                String masterDb = masterProperties        	.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);        masterUrl.append("/");                if (masterDb != null) {        	masterUrl.append(masterDb);        }                String slaveDb = slaveProperties        	.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);                slaveUrl.append("/");                if (slaveDb != null) {        	slaveUrl.append(slaveDb);        }                this.masterConnection = (com.mysql.jdbc.Connection) driver.connect(                masterUrl.toString(), masterProperties);        this.slavesConnection = (com.mysql.jdbc.Connection) driver.connect(                slaveUrl.toString(), slaveProperties);        		this.currentConnection = this.masterConnection;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#clearWarnings()	 */	public synchronized void clearWarnings() throws SQLException {		this.currentConnection.clearWarnings();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#close()	 */	public synchronized void close() throws SQLException {		this.masterConnection.close();		this.slavesConnection.close();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#commit()	 */	public synchronized void commit() throws SQLException {		this.currentConnection.commit();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#createStatement()	 */	public Statement createStatement() throws SQLException {		Statement stmt = this.currentConnection.createStatement();		((com.mysql.jdbc.Statement) stmt).setPingTarget(this);				return stmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#createStatement(int, int)	 */	public synchronized Statement createStatement(int resultSetType,			int resultSetConcurrency) throws SQLException {		Statement stmt = this.currentConnection.createStatement(resultSetType,				resultSetConcurrency);				((com.mysql.jdbc.Statement) stmt).setPingTarget(this);				return stmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#createStatement(int, int, int)	 */	public synchronized Statement createStatement(int resultSetType,			int resultSetConcurrency, int resultSetHoldability)			throws SQLException {		Statement stmt = this.currentConnection.createStatement(resultSetType,				resultSetConcurrency, resultSetHoldability);				((com.mysql.jdbc.Statement) stmt).setPingTarget(this);				return stmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getAutoCommit()	 */	public synchronized boolean getAutoCommit() throws SQLException {		return this.currentConnection.getAutoCommit();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getCatalog()	 */	public synchronized String getCatalog() throws SQLException {		return this.currentConnection.getCatalog();	}	public synchronized Connection getCurrentConnection() {		return this.currentConnection;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getHoldability()	 */	public synchronized int getHoldability() throws SQLException {		return this.currentConnection.getHoldability();	}	public synchronized Connection getMasterConnection() {		return this.masterConnection;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getMetaData()	 */	public synchronized DatabaseMetaData getMetaData() throws SQLException {		return this.currentConnection.getMetaData();	}	public synchronized Connection getSlavesConnection() {		return this.slavesConnection;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getTransactionIsolation()	 */	public synchronized int getTransactionIsolation() throws SQLException {		return this.currentConnection.getTransactionIsolation();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getTypeMap()	 */	public synchronized Map getTypeMap() throws SQLException {		return this.currentConnection.getTypeMap();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#getWarnings()	 */	public synchronized SQLWarning getWarnings() throws SQLException {		return this.currentConnection.getWarnings();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#isClosed()	 */	public synchronized boolean isClosed() throws SQLException {		return this.currentConnection.isClosed();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#isReadOnly()	 */	public synchronized boolean isReadOnly() throws SQLException {		return this.currentConnection == this.slavesConnection;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#nativeSQL(java.lang.String)	 */	public synchronized String nativeSQL(String sql) throws SQLException {		return this.currentConnection.nativeSQL(sql);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareCall(java.lang.String)	 */	public CallableStatement prepareCall(String sql) throws SQLException {		return this.currentConnection.prepareCall(sql);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareCall(java.lang.String, int, int)	 */	public synchronized CallableStatement prepareCall(String sql,			int resultSetType, int resultSetConcurrency) throws SQLException {		return this.currentConnection.prepareCall(sql, resultSetType,				resultSetConcurrency);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)	 */	public synchronized CallableStatement prepareCall(String sql,			int resultSetType, int resultSetConcurrency,			int resultSetHoldability) throws SQLException {		return this.currentConnection.prepareCall(sql, resultSetType,				resultSetConcurrency, resultSetHoldability);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String)	 */	public PreparedStatement prepareStatement(String sql) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql);		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String, int)	 */	public synchronized PreparedStatement prepareStatement(String sql,			int autoGeneratedKeys) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql, autoGeneratedKeys);		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)	 */	public synchronized PreparedStatement prepareStatement(String sql,			int resultSetType, int resultSetConcurrency) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql, resultSetType,				resultSetConcurrency);				((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int,	 *      int)	 */	public synchronized PreparedStatement prepareStatement(String sql,			int resultSetType, int resultSetConcurrency,			int resultSetHoldability) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql, resultSetType,				resultSetConcurrency, resultSetHoldability);		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String, int[])	 */	public synchronized PreparedStatement prepareStatement(String sql,			int[] columnIndexes) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql, columnIndexes);				((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#prepareStatement(java.lang.String,	 *      java.lang.String[])	 */	public synchronized PreparedStatement prepareStatement(String sql,			String[] columnNames) throws SQLException {		PreparedStatement pstmt = this.currentConnection.prepareStatement(sql, columnNames);		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);				return pstmt;	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)	 */	public synchronized void releaseSavepoint(Savepoint savepoint)			throws SQLException {		this.currentConnection.releaseSavepoint(savepoint);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#rollback()	 */	public synchronized void rollback() throws SQLException {		this.currentConnection.rollback();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#rollback(java.sql.Savepoint)	 */	public synchronized void rollback(Savepoint savepoint) throws SQLException {		this.currentConnection.rollback(savepoint);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setAutoCommit(boolean)	 */	public synchronized void setAutoCommit(boolean autoCommit)			throws SQLException {		this.currentConnection.setAutoCommit(autoCommit);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setCatalog(java.lang.String)	 */	public synchronized void setCatalog(String catalog) throws SQLException {		this.currentConnection.setCatalog(catalog);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setHoldability(int)	 */	public synchronized void setHoldability(int holdability)			throws SQLException {		this.currentConnection.setHoldability(holdability);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setReadOnly(boolean)	 */	public synchronized void setReadOnly(boolean readOnly) throws SQLException {		if (readOnly) {			if (currentConnection != slavesConnection) {				switchToSlavesConnection();			}		} else {			if (currentConnection != masterConnection) {				switchToMasterConnection();			}		}	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setSavepoint()	 */	public synchronized Savepoint setSavepoint() throws SQLException {		return this.currentConnection.setSavepoint();	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setSavepoint(java.lang.String)	 */	public synchronized Savepoint setSavepoint(String name) throws SQLException {		return this.currentConnection.setSavepoint(name);	}	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setTransactionIsolation(int)	 */	public synchronized void setTransactionIsolation(int level)			throws SQLException {		this.currentConnection.setTransactionIsolation(level);	}	// For testing	/*	 * (non-Javadoc)	 * 	 * @see java.sql.Connection#setTypeMap(java.util.Map)	 */	public synchronized void setTypeMap(Map arg0) throws SQLException {		this.currentConnection.setTypeMap(arg0);	}	private synchronized void switchToMasterConnection() throws SQLException {		swapConnections(this.masterConnection, this.slavesConnection);	}	private synchronized void switchToSlavesConnection() throws SQLException {		swapConnections(this.slavesConnection, this.masterConnection);	}		/**	 * Swaps current context (catalog, autocommit and txn_isolation) from	 * sourceConnection to targetConnection, and makes targetConnection	 * the "current" connection that will be used for queries.	 * 	 * @param switchToConnection the connection to swap from	 * @param switchFromConnection the connection to swap to	 * 	 * @throws SQLException if an error occurs	 */	private synchronized void swapConnections(Connection switchToConnection, 			Connection switchFromConnection) throws SQLException {		String switchFromCatalog = switchFromConnection.getCatalog();		String switchToCatalog = switchToConnection.getCatalog();		if (switchToCatalog != null && !switchToCatalog.equals(switchFromCatalog)) {			switchToConnection.setCatalog(switchFromCatalog);		} else if (switchFromCatalog != null) {			switchToConnection.setCatalog(switchFromCatalog);		}		boolean switchToAutoCommit = switchToConnection.getAutoCommit();		boolean switchFromConnectionAutoCommit = switchFromConnection.getAutoCommit();				if (switchFromConnectionAutoCommit != switchToAutoCommit) {			switchToConnection.setAutoCommit(switchFromConnectionAutoCommit);		}		int switchToIsolation = switchToConnection				.getTransactionIsolation();		int switchFromIsolation = switchFromConnection.getTransactionIsolation();				if (switchFromIsolation != switchToIsolation) {			switchToConnection					.setTransactionIsolation(switchFromIsolation);		}				this.currentConnection = switchToConnection;	}	public synchronized void doPing() throws SQLException {		if (this.masterConnection != null) {			this.masterConnection.ping();		}				if (this.slavesConnection != null) {			this.slavesConnection.ping();		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜在线观看视频| 久久精品国产一区二区三| 国产成a人亚洲精| 久久久噜噜噜久噜久久综合| 久久精品噜噜噜成人88aⅴ| 久久综合色之久久综合| 国内偷窥港台综合视频在线播放| 91精品国产综合久久精品图片| 亚洲电影激情视频网站| 欧美精品三级在线观看| 亚洲成va人在线观看| 欧美亚男人的天堂| 久久精品国产精品青草| 国产亚洲污的网站| 在线精品视频免费播放| 日韩va欧美va亚洲va久久| 国产午夜亚洲精品理论片色戒| 99精品桃花视频在线观看| 成人欧美一区二区三区1314| 在线观看国产精品网站| 免费高清在线一区| 久久国产尿小便嘘嘘| 色哟哟在线观看一区二区三区| 一区二区三区在线免费| 亚洲精品一区在线观看| 99r国产精品| 狠狠色狠狠色综合系列| 亚洲男人的天堂在线aⅴ视频| 日韩精品一区二区三区四区视频| av一二三不卡影片| 国产毛片精品国产一区二区三区| 国产精品久久久久精k8| 精品日产卡一卡二卡麻豆| 欧美中文字幕亚洲一区二区va在线| 国产制服丝袜一区| 三级影片在线观看欧美日韩一区二区 | 亚洲色图欧洲色图| 日本一区二区三区电影| 精品国产人成亚洲区| 日韩精品专区在线影院观看| 欧美日韩一区二区三区视频| 色诱视频网站一区| 在线精品观看国产| 欧美视频在线一区| 91久久国产最好的精华液| 99视频一区二区| 91免费视频大全| 欧美中文一区二区三区| 欧美性感一类影片在线播放| 色婷婷狠狠综合| 欧美精选一区二区| 日韩写真欧美这视频| 精品乱人伦一区二区三区| 亚洲精品一区二区三区在线观看| 天堂成人国产精品一区| 中文字幕乱码日本亚洲一区二区| 久久久久久亚洲综合影院红桃| 欧美一级久久久久久久大片| 久久夜色精品国产噜噜av| 中文字幕av在线一区二区三区| 国产精品久久午夜夜伦鲁鲁| 亚洲精品日韩专区silk| 五月天亚洲婷婷| 成人性生交大片| 欧美伦理电影网| 久久久精品免费免费| 亚洲综合图片区| 韩国在线一区二区| 欧美日韩午夜精品| 久久夜色精品国产欧美乱极品| 亚洲欧美在线视频观看| 蜜臀av一区二区三区| 色综合中文字幕| 日韩欧美另类在线| 亚洲一区二区av电影| 久草这里只有精品视频| 欧美亚日韩国产aⅴ精品中极品| 久久人人超碰精品| 天堂午夜影视日韩欧美一区二区| 国产成人精品综合在线观看 | 亚洲国产精品欧美一二99| 成人国产免费视频| 久久久99精品免费观看| 久久成人久久爱| 日韩精品综合一本久道在线视频| 亚洲一级电影视频| 色国产综合视频| 国产精品久久久久婷婷二区次| 久久www免费人成看片高清| 欧美电影免费观看高清完整版在线 | 26uuu色噜噜精品一区二区| 毛片一区二区三区| 欧美一级理论片| 久久99精品久久久久婷婷| 91精品国产全国免费观看| 一区二区三区高清不卡| 91免费看`日韩一区二区| 亚洲精品欧美在线| 欧美在线观看一二区| 天堂va蜜桃一区二区三区漫画版| 欧美日韩www| 久久99精品视频| 视频一区视频二区中文字幕| 欧美精品视频www在线观看| 秋霞成人午夜伦在线观看| 精品久久五月天| 91亚洲精华国产精华精华液| 亚洲成人高清在线| 欧美tickling网站挠脚心| 国产一区不卡视频| 久久99精品国产麻豆婷婷| 国产精品情趣视频| 欧美欧美欧美欧美首页| 国产成人av资源| 午夜久久久久久久久久一区二区| 日韩精品专区在线| 色婷婷综合久久久久中文一区二区| 亚洲精品成人天堂一二三| 精品国精品国产| 一本大道av伊人久久综合| 激情图片小说一区| 亚洲精品ww久久久久久p站| 9191成人精品久久| 99久久精品国产一区二区三区 | 日韩在线一二三区| 久久精品欧美日韩精品 | 91色.com| 成人性生交大片免费看在线播放 | 亚洲成人精品在线观看| 日本中文一区二区三区| 亚洲国产精品ⅴa在线观看| 91精品久久久久久蜜臀| 91亚洲精华国产精华精华液| 国产精品一区二区在线播放| 日韩av中文字幕一区二区| 亚洲成人先锋电影| 国产精品亚洲一区二区三区妖精| 麻豆91在线看| 精品一区二区三区免费| 国内精品伊人久久久久av影院| 免费观看久久久4p| 秋霞影院一区二区| 激情综合网av| 不卡的电影网站| 色美美综合视频| 欧美久久久久久久久久| 777午夜精品视频在线播放| 欧美妇女性影城| 亚洲精品在线免费观看视频| 日韩欧美卡一卡二| 久久青草欧美一区二区三区| 国产精品美女久久久久久久久 | 亚洲激情图片一区| 亚洲国产精品久久一线不卡| 日本欧美久久久久免费播放网| 韩日av一区二区| 色先锋久久av资源部| 国产99久久久久| 琪琪一区二区三区| 一区二区日韩电影| 国产精品无遮挡| 91国偷自产一区二区开放时间| 国产精品羞羞答答xxdd| 青青草国产成人av片免费| 成人免费在线播放视频| 久久精品一区二区三区不卡| 亚洲一区影音先锋| 99在线热播精品免费| 亚洲欧美色图小说| 不卡av电影在线播放| 国产精品天天看| 91欧美一区二区| 亚洲福利电影网| 在线播放欧美女士性生活| 日韩高清不卡一区二区| 日韩一区二区三区四区| 国产一区视频导航| 国产精品乱子久久久久| 日本高清成人免费播放| 性欧美疯狂xxxxbbbb| 精品久久五月天| eeuss鲁片一区二区三区在线看| 欧美精品一区二区高清在线观看| 五月婷婷综合在线| 欧美精品v日韩精品v韩国精品v| 一区二区三区国产精品| 在线观看成人小视频| 亚洲午夜久久久久久久久久久| 欧美性视频一区二区三区| 亚洲欧美另类综合偷拍| 欧美亚洲图片小说| 奇米888四色在线精品| 精品国产乱码久久久久久牛牛| 九九久久精品视频| 国产精品免费视频一区| 在线观看成人小视频| 男男视频亚洲欧美| 久久久99免费| 欧美三级视频在线| 国产精品1区2区3区在线观看|